How to separate 2 columns from a structure in MATLAB and save it into different variables(as a Matrix)

3 vues (au cours des 30 derniers jours)
Hi and have a great time
I have some timetables as it appears in the picture and each timetable can be a structure.
I have 4 columns but I want to load the second column as X values and the transpose of 3rd columns as Y values and then plot X in terms of Y
How can I do it ? (I don't know how to separate the columns of a timetable)
Thanks for your answers
Atefeh
  9 commentaires
Stephen23
Stephen23 le 25 Juil 2023
"I have some timetables as it appears in the picture and each timetable can be a structure."
No, what you have are clearly TIMESERIES objects:
S = load('output.mat')
S = struct with fields:
A: [1×1 timeseries] Bus4: [1×1 struct] Iabc0: [1×1 timeseries] Iabc1: [1×1 timeseries] Iabc2: [1×1 timeseries] Iabc3: [1×1 timeseries] Iabc4: [1×1 timeseries] Iabc5: [1×1 timeseries] Iabc6: [1×1 timeseries] Id_0: [1×1 timeseries] Id_1: [1×1 timeseries] Id_2: [1×1 timeseries] Id_3: [1×1 timeseries] Id_4: [1×1 timeseries] Id_5: [1×1 timeseries] Id_6: [1×1 timeseries] Vabc0: [1×1 timeseries] Vabc1: [1×1 timeseries] Vabc2: [1×1 timeseries] Vabc3: [1×1 timeseries] Vabc4: [1×1 timeseries] Vabc5: [1×1 timeseries] Vabc6: [1×1 timeseries] Vd_0: [1×1 timeseries] Vd_1: [1×1 timeseries] Vd_2: [1×1 timeseries] Vd_3: [1×1 timeseries] Vd_4: [1×1 timeseries] Vd_5: [1×1 timeseries] Vd_6: [1×1 timeseries] tout: [1000×1 double]
A = S.Id_6
timeseries Common Properties: Name: '' Time: [3001x1 double] TimeInfo: tsdata.timemetadata Data: [3001x3 double] DataInfo: tsdata.datametadata
D = get(A,'Data')
D = 3001×3
-0.0970 -0.1256 -0.0000 -0.0978 -0.1249 0.0000 -0.0985 -0.1243 0.0000 -0.0993 -0.1237 0.0000 -0.1001 -0.1231 0.0000 -0.1009 -0.1224 0.0000 -0.1016 -0.1218 0.0000 -0.1024 -0.1212 0.0000 -0.1032 -0.1205 0.0000 -0.1039 -0.1199 0.0000
Atefeh
Atefeh le 25 Juil 2023
Yes! It works.
I really appreciate your professional feedback.

Connectez-vous pour commenter.

Réponses (1)

Atefeh
Atefeh le 22 Sep 2023
Hello
I have an output file of my Simulink Model which is attached.
I want to plot a 3D model as a mfile based on Id_6 (column 1&2) and t
Can you advise?

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by