Doubt involving a for loop within another
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ana Carolina da Silva Pacheco
am 16 Mai 2021
Kommentiert: Ana Carolina da Silva Pacheco
am 16 Mai 2021
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 Kommentare
Akzeptierte Antwort
David Fletcher
am 16 Mai 2021
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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!