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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2013-2-17
I can't imagine the code either. I'm still waiting for the Mathworks to give me the beta version of their Mind Reading Toolbox. It's been a frustratingly long wait, especially when we see so many situations, just like this one, where we could put it to immediate use.
Walter Roberson
2013-2-17
I already know what's in the Mind Reading Toolbox:
function Read_Programmers_Mind(varargin)
disp('Ask Walter')
end
;-)
回答(2 个)
Walter Roberson
2013-2-17
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
0 个评论
manoj saini
2013-2-17
for k=1:210 v(1,:)=your calculation end
try it....it will save your all 210 values
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!