Doubt involving a for loop within another
2 次查看(过去 30 天)
显示 更早的评论
Ana Carolina da Silva Pacheco
2021-5-16
评论: Ana Carolina da Silva Pacheco
2021-5-16
I have the code below that is returning the results shown:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/619998/image.png)
My problem is that I want the variable "jvals" to be a matrix just like "vetor_momentoj", so that I can store the values returned from the linspace of each interaction i=1:it. Can anybody help me, please?
P.S. this is just a test code, and the value 0.03 used to define jvals is hypotetical. In the real code this value depends on the index i.
0 个评论
采纳的回答
David Fletcher
2021-5-16
Try changing the line to:
jvals(i,:)=linspace(0,0.03,n)
You may also need to change the line to
curvatura=jvals(i,j)
if curvatura is intended to be a scaler in that loop (though I don't see where it is used, so I assume you haven't added it to the code)
更多回答(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!