フィルターのクリア

Assigning Function Name with "for" loop

6 ビュー (過去 30 日間)
Özgür Alaydin
Özgür Alaydin 2022 年 2 月 17 日
コメント済み: Özgür Alaydin 2022 年 2 月 22 日
Hello all,
I have a 3x3x3 matrix and i want to seperate each of this matrix with a different name.
So that i tried to use the funciton given below but i got the error "Unable to perform assignment because the indices on the left side are not compatible with the size of the right side".
In the function psi11 is 3x3x3 matrix. How can i assign variable name with for loop?
I want to name all new functions as psi11(k).
for k=1:7
strcat('psi11',num2str(k)) = squeeze(psi11(:,k,:))
end

採用された回答

Steven Lord
Steven Lord 2022 年 2 月 17 日
Can you define variables this way? Yes.
Should you do this? The general consensus is no. See that Answers post for an explanation and alternatives.
  1 件のコメント
Özgür Alaydin
Özgür Alaydin 2022 年 2 月 22 日
Thanks for good advice.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by