How to get split to return a string array?
Mostra commenti meno recenti
Hello,
I am trying to read a text file and split each line into space-delineated components. Using split I always get a cell array as output, and then have to use cell2mat to convert each cell to a string. According to matlab documentation, if the input field is a string array, the output will be a string array, but that is not how it is working for me. What am I doing wrong?
str = fgetl(filepointer);
substrings = split(str);
Isn't substrings a string array? If I say ischar(substring), the answer is 1. I have also tried fgets but the result is the same.
It is just clunky to have to call cell2mat before processing every chunk of the string.
thank you.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!