MATLAB Answers

Hi, I have a loop which calculate 110 values of velocity, i want to assign all these values in one array. Every time i try only the last value is assigned. Any help ????

1 view (last 30 days)
Ahmed
Ahmed on 17 Feb 2013
Hi, I have a loop which calculate 110 values of velocity, i want to assign all these values in one array. Every time i try only the last value is assigned. Any help ????
  3 Comments
Walter Roberson
Walter Roberson on 17 Feb 2013
I already know what's in the Mind Reading Toolbox:
function Read_Programmers_Mind(varargin)
disp('Ask Walter')
end
;-)

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 17 Feb 2013
You probably have something like
for i = 1 : 110
velocity = ... some function involving i ...
end
Instead you need to use
for i = 1 : 110
velocity(i) = ... some function involving i ...
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by