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

 Accepted Answer

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

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!