フィルターのクリア

Set an empty cell array equal to zero.

13 ビュー (過去 30 日間)
JE
JE 2015 年 10 月 15 日
編集済み: Image Analyst 2015 年 10 月 16 日
So I have a cell array that equals {[]} because it's empty. How can I create an empty array equal to zero using an if then statement?
My attempt:
if strcmp(stopcodon1,'[]');
stopcodon1=0;
end
It doesn't work at all.

採用された回答

dpb
dpb 2015 年 10 月 15 日
Actually, the cell array itself is not empty, it holds an empty array. And, empty isn't a string value anyway so that comparison wouldn't work even if there were an equality test for empty (which there isn't). All in all, that's barking up the wrong tree entirely... :)
if isempty(stopcodon1{:})
...
should lead to nirvana. Or, of course, modify program logic to not create the cell variable if the array itself is empty (altho that may break some other symmetry in algorithms, granted).
  1 件のコメント
JE
JE 2015 年 10 月 15 日

I LOVE YOU.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by