What changed about matlab and tabs in a recent update?
3 ビュー (過去 30 日間)
古いコメントを表示
I am using (fairly simple) code to cut out part of a tsv file. This code is working in R2018b but not in R2020b:
line_cell = strsplit(tlines{i}(), '\t');
Where tlines is an array of strings with tabs such as
tlines{4}() = 'g1 : 14.203 79.931 50.598'
Now R2018b give me
1×5 cell array
{'g1'} {':'} {'14.203'} {'79.931'} {'50.598'}
As it should. But R202b give me:
1×1 cell array
{'g1→:→14.203→79.931→50.598'}
What changed in the updates and how can you get the old (correct) functionality back?
採用された回答
Jan
2021 年 1 月 29 日
編集済み: Jan
2021 年 1 月 29 日
I cannot confirm your observation:
str = {sprintf('g1\t:\t14.203\t79.931\t50.598')}
% str = 1×1 cell array
% {'g1→:→14.203→79.931→50.598'}
strsplit(str{1}, '\t')
% 1×5 cell array
% {'g1'} {':'} {'14.203'} {'79.931'} {'50.598'}
This is the output in Matlab Online 2020b.
0 件のコメント
その他の回答 (1 件)
Steven Lord
2021 年 1 月 29 日
tlines = sprintf('g1\t:\t14.203\t79.931\t50.598')
split(tlines, '\t') % tlines{4} does not contain the characters \ and t
split(tlines, sprintf('\t')) % but it does contain the tab character
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!