如何在matlab里用for遍历五个矩阵。

2 ビュー (過去 30 日間)
dmqkye
dmqkye 2023 年 5 月 22 日
回答済み: xupfbeg 2023 年 5 月 22 日
比如说我现在有P1到P5五个矩阵
for L=1:5
I=PL;
这样写是不对的,现在的问题是,如果不用三维矩阵,应该如何更改PL呢,试了P'L'也不行,P[int2str(L)]也不行
请各位大神不吝赐教:'(

採用された回答

xupfbeg
xupfbeg 2023 年 5 月 22 日
仅供参考
P1=rands(1,5);
P2=rands(1,5);
for i=1:2
    I=eval(['P',num2str(i)])
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB 快速入门 についてさらに検索

Community Treasure Hunt

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

Start Hunting!