How can I assign an empty value to a variable without getting the error "Unable to perform assignment because the left and right sides have a different number of elements."
古いコメントを表示
MATLAB treats empty values as an empty vector. So, how can I avoid the afforementioned error in this case:
f = zeros(1,50);
for kk = 1: 50
[~, maxidx] = max(Mavg(:,:,kk));
f(kk) = find((Mavg(:,:,kk) <= ratio * N) & (maxidx <= 1:length(Mavg(:,:,kk))), 1 );
if isempty(f(kk))
f(kk) = 51;
end
end
1 件のコメント
Waseem AL Aqqad
2021 年 12 月 10 日
編集済み: Waseem AL Aqqad
2021 年 12 月 10 日
採用された回答
その他の回答 (1 件)
Walter Roberson
2021 年 12 月 10 日
You can't do that.
N = 50;
f = zeros(1,N);
for kk = 1: N
[~, maxidx] = max(Mavg(:,:,kk));
fkk = find(SOMETHING_NOT_CLEAR_WHAT);
if isempty(fkk)
fkk = N+1;
end
f(kk) = fkk;
end
カテゴリ
ヘルプ センター および File Exchange で Fixed-Point Math Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!