Storing Data from While loop
显示 更早的评论
Hello, I'm trying to create a matrix with the outputs of a while loop. Attached is an image which will help visualize what I'm doing. The y-axis is Y, and the x-axis is i.

Every time the y-value is at 4 I want to evaluate a function of those indices and store in a matrix. When the function is at 5 and returns to 4 I'd like to create a new index in the matrix and evaluate the function.
heres what i have
for i = (25600:26000)
while y == 4
for n = 1:50
A(n) = log (i)
else
A (n) = A (n+1)
end
end
Thanks for your help!
1 个评论
Stephen23
2015-1-25
Do not use i (or j) as the names of your variables, as these are the names of the inbuilt imaginary unit .
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!