How to convert 2*1 cell array into 1*2char array
Ältere Kommentare anzeigen
egr = Tier' % egr returns 'T2' 'S2' as 1*2 CELL
sgr = char(egr); % sgr returns T2
S2 as 2*2 char
My desired output should look like 'T2' 'S2' or 'T2','S2' in char
1 Kommentar
Guillaume
am 22 Okt. 2018
Note that the only way a 2x1 cell array can be converted into a 1x2 char array is if each cell of the array contain a single character, or one cell contains 2 characters and the other none.
Akzeptierte Antwort
Weitere Antworten (1)
madhan ravi
am 22 Okt. 2018
Bearbeitet: madhan ravi
am 22 Okt. 2018
Tier={'T2';'S2'}'
egr=Tier
c=char(egr)
7 Kommentare
raghavendra kandukuri
am 22 Okt. 2018
madhan ravi
am 22 Okt. 2018
See edited answer now
Guillaume
am 22 Okt. 2018
It's really not clear what you want. I would have thought that madhan's answer was what you asked for.
Please give a full example of an input and the desired output, using valid matlab syntax (as madhan did).
raghavendra kandukuri
am 22 Okt. 2018
Bearbeitet: raghavendra kandukuri
am 22 Okt. 2018
madhan ravi
am 22 Okt. 2018
Bearbeitet: madhan ravi
am 22 Okt. 2018
Thank you Guillame, @Raghavendra unfortunately we can’t see your comment for some reason
Image Analyst
am 22 Okt. 2018
Try again - I rescued it from the spam quarantine.
raghavendra kandukuri
am 22 Okt. 2018
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!