array of strings into 2 number array
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
fima v
am 17 Feb. 2017
Kommentiert: Walter Roberson
am 17 Feb. 2017
Hello, i have an array of 3 strings,each string is consists of two numbers spaced by tab. i would like to create a 2X3 2D array.i thought of going with for loop using strsplit and str2num. is there an easier way,without for loop?
Thanks
1 Kommentar
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 17 Feb. 2017
TAB = sprintf('\n');
output = str2double( cellfun(@(S) strsplit(S, TAB), YourCell, 'Uniform', 0) );
or
temp = regexp(YourCell, '\t', 'split');
output = str2double( vertcat(temp{:}) );
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!