I can't figure out the appropriate syntax to do this. I have 4 vectors that each have 15 elements. I want to extract a vector of length 4 containing the first element of each of my original vectors, and then do things with it. Then I want to do the same things with the second element of each vector, etc. and store all the answers in a matrix or array. Something like this:
for i = 1:15
new_vec=zeros(4);
n=1;
for fc = {vec_A, vec_B, vec_C, vec_D}
new_vec(n)=fc(i);
n=n+1;
end
Final_answers{i}=functionDoThings(new_vec);
end
But I get:
> The following error occurred converting from cell to double: Error
> using double Conversion to double from cell is not possible. Error in
> my_script (line 31)
> new_vec(n)=fc(i);
I feel like there is a simpler way to do this that I am missing.