How to assign value in multidimensional variable?

1 回表示 (過去 30 日間)
Jhon Gray
Jhon Gray 2020 年 11 月 23 日
編集済み: Ameer Hamza 2020 年 11 月 23 日
I was trying to assign value in a multidimensional variable. My first code is wroking Here it is:
prod = 1; ch = 1;
AAA(prod,ch,:) = A;
This code gives me this output in worksapce
But My 2nd code where I just increase the number of dimension. It gives me error. Here is the code:
prod = 1; ch = 1;sub = 1;
AAA(sub,prod,ch,:) = A;
This gives me error like this:

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 23 日
編集済み: Ameer Hamza 2020 年 11 月 23 日
It will only give error if AAA is already defined. Try the following code
clear AAA
prod = 1; ch = 1;sub = 1;
AAA(sub,prod,ch,:) = A;

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by