Change data type of entire cell array?
Ältere Kommentare anzeigen
I have a 1 x 2500 cell array created from a .txt file. Each cell has one long string of many individual numbers that I need. EX: '1 2 3 4 5 6 7 8 9'
I need to make each number in the entire cell array a double value type. str2double doesn't work because I need to split up the string. I tried using strsplit but maybe I was doing it wrong.
Any advice?
Antworten (1)
madhan ravi
am 18 Nov. 2020
cellfun(@(x) sscanf(x, '%d').', Cell_array, 'un', 0)
1 Kommentar
Tyler Bodnarik
am 18 Nov. 2020
Kategorien
Mehr zu Data Type Conversion 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!