フィルターのクリア

how to create character matrix help

3 ビュー (過去 30 日間)
Huseyin
Huseyin 2014 年 3 月 3 日
回答済み: per isakson 2014 年 3 月 3 日
Hi, I created a function called 'myfunction' and lets say the possible outputs of that functions are 'a','b','c' or 'ab'. Then I call this function for another process in a for loop. The code is;
a=0;
for k=1:4
liste(1+a,:)=myfunction(process);
a=a+1;
end
The answer must be 'a', 'b', 'c', 'ab' but the answer of this code is just 'a','b','c' and it stops and gives me an error about dimensions. I think the problem occurs because 'ab' is formed of 2 characters. How can I fix that??
Thanks

採用された回答

per isakson
per isakson 2014 年 3 月 3 日
liste = cell(4,1);
...
liste{1+a,1} = myfunction( process);
...
liste = char(liste);
or initialize
liste = repmat( ' ', [4,2] );
and fill in the output of myfunction (faster but a little bit more tricky )

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by