Multiple lines in single cell
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have a cell array as trob = 2*1 cell with sub cells as 4*1 and 5*1
trob={{'1.Check number'
'2.Should the issue be consistent'
'3.Understand the issue'
'4.Check compatibility '};
{'1.Check version '
'2.Check issue '
'3.Check on different connectors.'
'4.Run diagnostic).'
'5.Send defect'}}
I neead to create as trob = 2*1 cell and sub cells as 1*1 insead of 4*1 ad 1*1 instead of 5*1. Is it possible to do that. I tried with '\n'... also its not working for me.Please help me if anyone knows
0 Kommentare
Antworten (1)
Bob Thompson
am 8 Mai 2019
If I am understanding you correctly, you want to use to combine your strings into a single string, but maintain the individual rows. I would suggest using join.
for i = 1:length(trob)
trob(i) = join(trob(i),'\n')
end
The results of this is two cell arrays with all sentances strung together with \n delimiters. It is not pretty to look at in the workspace, but if you print it with fprintf you receive the format you're looking for.
>> fprintf(trob{1})
1.Check number
2.Should the issue be consistent
3.Understand the issue
4.Check compatibility >> % The next line starts here because we haven't put a \n on the end of the last line
0 Kommentare
Siehe auch
Kategorien
Mehr zu TDMS Format Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!