Why the first cell is printed in one row and second in two? (fprintf)

1 Ansicht (letzte 30 Tage)
Why the first cell is printed in one row and second in two? I want the second cell to be printed in one row, same as first.
fprintf('%s,...\n',maCell{:})
Output:
Y_X_mAb,...
g_Gravitational_acceleration
,...
Desired output:
Y_X_mAb,...
g_Gravitational_acceleration,...

Akzeptierte Antwort

Stephen23
Stephen23 am 6 Jun. 2018
Bearbeitet: Stephen23 am 6 Jun. 2018
The problem is that the data itself contains newline characters (10=\n):
>> +maCell{2}(end)
ans = 10
Remove those characters and you will not have this problem:
maCell = deblank(maCell);

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by