I want to assign the value from a textscan directly to an simple variable, can I do this? Example:
str = '223 87 87';[Nx, Ny, Nz] = textscan(str, '%f %f %f');
I know this doesn't work, because textscan returns a cell array, rather than a list of numbers. So I could do something like
Narray = textscan(str, '%f %f %f');Nx = Narray{1}; Ny = Narray{2}; Nz = Narray{3}; clear Narray;
But then it takes two lines and an extra cell array that I never wanted to exist in the first place…it seems inefficient and less readable. Is there a way that I can have the output from textscan assigned directly to the variables I want, or is an intermediate cell array always necessary? Thanks!
Best Answer