0
votes

Length of variables lets call n which will create x{i]..to x{n} different variables Now i can create those but i want all individual to have sin function with different values. Let say t=0:1:5; length(t)=6 thus sin(t) will be matrice with length 6. i tried a code below of course i should update the cell functions length but How can i make; x{1}=sin(t),x{2}=sin(t) etc.All variables will have their own matrices.Whats your suggestions?

for i=1:n
            for t=0:1:5;
           x=cell(1); 
        x{i} = sin(t)


            end
        end
1
Do you want t to be fixed? - RDizzl3
I don't see the use of creating multiple copies of the same vector, but here it is to satisfy your needs - x = repmat({sin(t)},n,1) - Divakar

1 Answers

0
votes

You are on the right track:

t = 0:1:5;
m = size(t,2);
x = cell(m,1);

for k = 1:m
x{k} = sin(t);
end

Each entry in the cell array will be a matrix.