How to convert the present data into another format?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Bhavnish
am 24 Sep. 2014
Kommentiert: Bhavnish
am 26 Sep. 2014
I have data in the following format. temp = a: [1x315 double] b: [1x315 double] c: [1x315 double] d: [1x315 double] e: [1x315 double] f: [1x315 double]
I need to convert this data into following format: temp = data: [315x6 double] var: {'a' 'b' 'c' 'd' 'e' 'f'} Please suggest how should I do this conversion.
0 Kommentare
Akzeptierte Antwort
Roger Wohlwend
am 25 Sep. 2014
temp = [a; b; c; d; e; f]';
6 Kommentare
Joseph Cheng
am 25 Sep. 2014
which in this case would be fine. I usually read all entries to an accepted question as sometimes people comeback with different methodologies. But yes in general somehow people are confused with posting here. (the {}code button is a prime example)
Weitere Antworten (1)
Joseph Cheng
am 25 Sep. 2014
to expand on Roger's answer you you can build the structure like this
a = randi(10,1,351);
b = randi(10,1,351);
c = randi(10,1,351);
d = randi(10,1,351);
e = randi(10,1,351);
f = randi(10,1,351);
temp.data = [a; b;c;d;e;f]';
temp.var = {'a' 'b' 'c' 'd' 'e' 'f'};
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!