How can I get numerical data from character array.
Ältere Kommentare anzeigen
Hello everyone,
I would like to take numerical array from character array.The example of character array is following
if true
% code
filename(1)='test2 1234.csv';
filename(2)='test1111 3425.csv';
end
in this situation, how can i take the numerical array from filename(1) and (2)?
Thank you for reading.
1 Kommentar
James Tursa
am 8 Dez. 2017
Maybe you meant to use a cell array?
filename{1}='test2 1234.csv';
filename{2}='test1111 3425.csv';
Also, what would be your desired output? I.e., what is the "numerical array" that you would take from the filenames?
Antworten (1)
Jan
am 8 Dez. 2017
filename{2} = 'test1111 3425.csv';
num = sscanf(filename{2}, 'test%d %d.csv')
1 Kommentar
Kazuki Shigyo
am 8 Dez. 2017
Kategorien
Mehr zu データ型の変換 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!