About Cell arrays access
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I have the following question... Suppose I have a cell array given by:
a{1}={'teste' 4},
a{2}={'meste' 5},
a{3}={'zeste' 6},
How could I have access to the letters 't' 'm' and 'z' at the same time. It means, I would like a command line in terms of () [] and {} in such a way I could get these letters (or the numbers!!) and save them in a new variable.
0 件のコメント
回答 (1 件)
Jos (10584)
2016 年 4 月 6 日
a{1}={'teste' 4},
a{2}={'meste' 5},
a{3}={'zeste' 6},
B = cellfun(@(x) x{1}(1),a)
2 件のコメント
Kleber Zuza Nobrega
2016 年 4 月 6 日
Walter Roberson
2016 年 4 月 7 日
You cannot do it with just () [] {}. You need some form of iteration, or you need at least one anonymous function to help, or you need to assign to at least one variable. (I have been able to do it with two temporary assignments.)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!