If I have three strings, such as 'Y20194'
, '219Y42'
, and '12345'
how do I break these up into a vector like [Y 2 0 1 9 4]
, [1 2 3 4 5]
, and [2 1 9 Y 4 2]
? I am using str2num
, but I think I am missing a step (separating the individual numbers in the strings first) before I convert to numerical values. Also, the characters aren't reading correctly and using str2num
gives me [].
I have a file with lines of strings such as the one above. I used fgetl
to read each line of my file into strings but am kind of stuck beyond that.