How to plot variables from a table?
8 views (last 30 days)
I have a table with variables (as depicted below and attached).
I want to plot the varibales highlighted red (for example). I do this in this way.
% convert the variables to categorical array (because this allows me to plot the variables)
data.time = categorical(data.time);
data.l_avgP = categorical(data.l_avgP);
% plot the variables
ylabel('Average pressure (kPa)');
xlabel ('Time stamp (hours)');
Which results in this:
Apart from the visible issues, this is very slow (40 sec to produce a plot). Could you please suggest a more effiicient way to do this?
dpb on 17 Nov 2021
>> load Xsensor_ID002_SN01_XT001_XSN.mat
Elapsed time is 0.087834 seconds.
You need to go back to reading in the table to begin with -- somehow you managed to create the table as strings in cells instead of converting to native values on input.
Without the input data file, we can't tell why/how that happened, but readtable should bring in the data as numeric for everything other than the time which should be a duration.