Set empty vector equal to zero?
古いコメントを表示
I have a cell array that is empty.
I want to create an if then statement that would let me set any vector that turns out to be empty..to equal zero.
I've tried using the null statement, but I'm running into problems. Does anyone know how I could do this? It does not have to be an if then statement.
2 件のコメント
the cyclist
2015 年 10 月 15 日
It may seem to you that you are stating your problem clearly, but I for one do not really understand at all what you are trying to do. Remember, we don't know anything at all about your problem, except what you say here.
Can you give an example of the input you have, and the output you expect from the algorithm you want. Can you show us the code you have that is not working, and describe what specifically went wrong?
JE
2015 年 10 月 15 日
編集済み: Walter Roberson
2015 年 10 月 15 日
回答 (1 件)
Walter Roberson
2015 年 10 月 15 日
idx = cellfun(@isempty, stopcodon1);
stopcodon1(idx) = {0};
カテゴリ
ヘルプ センター および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!