Code works in matlab command window, doesn't work in app designer code view
古いコメントを表示
Hi all,
I have a Datamatrix A with size 393x171
from this I make a new matrix B with certain columns from matrix A.
B=A(:,2:5:68); size 393x14
and then from it only the maximum values in one column
B=max(B,[],2); size 393x1
If I write these codes in matlab command window, it works very well and no error.
If I write same codes in app designer code view, it doesn't work and give below errors.
B=A(:,2:5:68); --> Index in position 2 exceeds array bounds (must not exceed 1).
B=max(B,[],2); -->Error using max, Invalid data type. First argument must be numeric or logical.
Thank you in advance for your support.
Mustafa
6 件のコメント
DGM
2021 年 4 月 7 日
It seems to me that the problem isn't with these lines, but the fact that A doesn't have the expected size. You'll need to verify that (check size(A) before that first line) and then try to find out why it's happening. If you can produce a working example of the error, you can attach relevant files or code excerpts.
Abdul Basith Ashraf
2021 年 4 月 8 日
You are overwiting B. Could that be the issue?
While you debug, use a new variable
C=max(B,[],2);
Mustafa Uslu
2021 年 4 月 8 日
編集済み: Mustafa Uslu
2021 年 4 月 8 日
Mustafa Uslu
2021 年 4 月 8 日
Jan
2021 年 4 月 8 日
The readers cannot guess that "Datamatrix A with size 393x171" means a struct array.
Mustafa Uslu
2021 年 4 月 8 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Import and Management についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!