access data at specific position in cell
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everybody,
I’d like to extract values out of a cell. In the beginning the cell (e.g. 1x3) contains other cell arrays, e.g.:
cell{1,1}
„hello“,“world“,500
„hello“,“world“,600
cell{1,2}
„hello“,“USA“,1.5
„hello“,“USA“,1.8
Now I want to code a for loop, which gets me the values after the last “,” in every cell. Right now I’m using this code within a for loop:
Position_komma{:,i} = strfind(cell{1,i}, ','); Position_last_komma{:,i} = cellfun(@(v) v(end), Position_Komma{1,i});
And finally I convert the cells to a cell which does not contain other cells anymore:
cell=[cell{:}]; Position_last_komma=[Position_last_komma{:}];
So cell (now 2x3) looks like this:
„hello“,“world“,500 „hello“,“USA“,1.5 „hello“,“australia“,0.5999 „hello“,“world“,600 „hello“,“USA“,1.8 „hello“,“australia“,0.86
And Position_last_komma (2x3 double) like this:
16 14 20 16 14 20
Finally I need to get every string after the last komma in each cell, but I’m not able, to go into e.g. cell{1,1} and to the 17th digit in there. I hope I made my point clear and someone can help me!
Cheers, Christian
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!