>> fmt1=repmat('%f',1,3);
>> t=cell2mat(textscan(s,fmt1,'delim',',','collectout',1,'whitespace','"'))
t =
1 2 3
NaN 2 3
1 NaN 3
1 2 NaN
NaN NaN NaN
>> fmt2=repmat('%s',1,3);
>> t=textscan(s,fmt2,'delim',',','collectout',1,'whitespace','"')
t =
1×1 cell array
{5×3 cell}
>> t{:}
ans =
5×3 cell array
{'1"' } {'2"' } {'3"' }
{0×0 char} {'2"' } {'3"' }
{'1"' } {0×0 char} {'3"' }
{'1"' } {'2"' } {0×0 char}
{0×0 char} {0×0 char} {0×0 char}
>>
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/402792-yet-another-textscan-question#comment_572500
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/402792-yet-another-textscan-question#comment_572500
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/402792-yet-another-textscan-question#comment_572559
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/402792-yet-another-textscan-question#comment_572559
Sign in to comment.