フィルターのクリア

Reading file with pilcrow (paragraph) sign

2 ビュー (過去 30 日間)
Sergio Vez
Sergio Vez 2019 年 10 月 29 日
コメント済み: Sergio Vez 2019 年 10 月 29 日
I need to read a file with rows like this
calculation.update.date=09.10.2019¶
I'm textscanning the ".txt" into 2 column matrix (one with "calculation.update.date" and the other one with "09.10.2019¶")
To do that I used
opt = {'Delimiter','='};
data_type = '%s%[^\n]';
fileID = fopen('ENTRADA.txt','rt');
C_aux = textscan(fileID,data_type,opt{:},'CollectOutput',1);
I would like to do the same but getting "09.10.2019" in the second column instead of "09.10.2019¶"
I would also like to be able to include a at the end of each row when finishing the program, in order to export it in a proper way.
How could I do it?
Thanks in advanced!
Sergio
  1 件のコメント
Sergio Vez
Sergio Vez 2019 年 10 月 29 日
Could you guys help me please?

サインインしてコメントする。

採用された回答

Stephan
Stephan 2019 年 10 月 29 日
編集済み: Stephan 2019 年 10 月 29 日
This should help:
>> A = '09.10.2019¶'
A =
'09.10.2019¶'
>> A(end) = []
A =
'09.10.2019'
also maybe helpful:
>> a = '¶'
a =
'¶'
>> double(a)
ans =
182
also note:
>> A = "09.10.2019¶" % String instead of char!
A =
"09.10.2019¶"
>> whos A
Name Size Bytes Class Attributes
A 1x1 166 string
>> A(end) = [] % This doesnt work!
A =
1×0 empty string array
>> A = char(A)
A =
'09.10.2019¶'
>> whos A
Name Size Bytes Class Attributes
A 1x11 22 char
>> A(end) = []
A =
'09.10.2019'
  9 件のコメント
Stephan
Stephan 2019 年 10 月 29 日
I missunderstood you... sorry - see attached file
Sergio Vez
Sergio Vez 2019 年 10 月 29 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by