MATLAB: The first cell is printed in one row and second in two? (fprintf)

fprintfMATLAB

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,...

Best Answer

  • 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);