Clear Filters
Clear Filters

How do i plot data from a structure? and extract data from a structure?

3 views (last 30 days)
Hi!
I have been given several tables of values, which cannot be opened, only read directly into matlab using the command "importdatat". When I do that, it saves the values in a structure, like below:
SpeedA=
struct with fields:
distanceA_km: [1716*1 double]
SpeedA_kmph: [1716*1 double]
My question is, how can now sort of "unpack" this structure, to plot it or see it in table/array/vector form? Plotting would help, as i am supposed to create a linear approximation of the values. I tried using struct2cell and then cell2mat, but that gives me all the values in one column, whereas they should appear in 2 columns, seperated between speed and distance. What do i ?
Thanks!

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 27 Nov 2018
[SpeedA.distanceA_km, SpeedA.SpeedA_kmph]

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!