Multiple lines in single cell

8 visualizaciones (últimos 30 días)
Haritha
Haritha el 8 de Mayo de 2019
Respondida: Bob Thompson el 8 de Mayo de 2019
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

Respuestas (1)

Bob Thompson
Bob Thompson el 8 de Mayo de 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

Categorías

Más información sobre TDMS Format Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by