user1810659
user1810659

Reputation: 221

MATLAB: plotting data from struct

I have a structure of data that contains data values, time, unit, and some descriptions of each data. I want to plot the data values vs time. Here is how the data looks like:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Any ideas how i can plot the data and time?

Upvotes: 0

Views: 5726

Answers (2)

Aakash Sehgal
Aakash Sehgal

Reputation: 171

You Need not open the entire readings and then plot the Graphs of those. Instead you can directly Access the strucure and plot the graph by this command :

  • plot(data.(data.arrayOfTimestamp),data.arrayOfValue)

Upvotes: 1

Amro
Amro

Reputation: 124563

Quick example:

%# date strings and values
dates = {'02.11.2012 00:02:15'; '02.11.2012 00:07:12'};
values = [5.8; 5.7];

%# convert to serial date numbers
t = datenum(dates, 'mm.dd.yyyy HH:MM:SS');

%# plot and format x-ticks as datetime
plot(t,values)
datetick('x')

Upvotes: 0

Related Questions