dlmread of a cellarray already in workspace?

Hello,
I 'm given a char cell array, for example 3x1 in size, like the following:
'1 3FF 123'
'0 FFE 234524'
'5 8BA 0458'
I want to convert it to 3 column vectors in dec, hex(or char), and then dec format.
If the cell array is a file, I can easily use dlmread or something like that. But I don't know how I can do that with a cell array. cell2mat doesn't work since the number of characters in each cell are not the same.
Thanks

 採用された回答

Matt Fig
Matt Fig 2012 年 8 月 15 日

0 投票

Will this work?
F = {'1 3FF 123';'0 FFE 234524';'5 8BA 0458'};
G = cellfun(@(x) sscanf(x,'%d %x %d'),F,'Un',0);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by