loop to extract rows and giving the vectors progresseiv numbers

1 回表示 (過去 30 日間)
amoda
amoda 2022 年 8 月 6 日
回答済み: Voss 2022 年 8 月 6 日
Hello,
I have a matrix of size A= [70x1459], I need to extract every row i of it and putting it in a vector M_(i), so I can plot any of them with another vector B=[1x1459].
I wanted to use a loop to achieve that easily and quickly, like following to get M1,M2 etc...:
for i=1:70
M_(i)=DehnMatrix(i,:)
end
but it doesnt work, can anyone tell me what I'm messing.
thanks in advance.

採用された回答

Voss
Voss 2022 年 8 月 6 日
There's no need to make each of several rows of a matrix into its own variable (M1, M2, etc.)
Instead just use indexing to get the rows you need when you need them
For example, to plot the first 25 rows of DehnMatrix:
DehnMatrix = rand(40,1459);
plot(DehnMatrix(1:25,:).')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by