Clear Filters
Clear Filters

unable to plot columns of multiple cells

1 view (last 30 days)
Sonali
Sonali on 6 Nov 2023
Commented: Star Strider on 8 Nov 2023
My program is attached.
I am working with cell, the last one is a 2D cell. I am unable to plot col_3 v/s col_1 logscale on X-axis along with the error bars.
I was wondering if someone could help me.
Thanks

Answers (1)

Star Strider
Star Strider on 6 Nov 2023
Logarithms of time variables do not actually exist (probably anywhere), however there are ways to get round that problem.
This plots ‘t_sclk’ against ‘t_utc’ using a semilogx scale —
% type('distribution.mlx')
T1 = readtable('mvn_ngi_l2_ion...8_v08_r01.csv')
T1 = 16393×19 table
t_utc t_unix t_sclk t_tid tid orbit focusmode alt lst long lat sza ion_mass cps_dt abundance sensitivity SC_potential precision quality ____________________ __________ __________ ______ _____ _____ _________ ______ ______ ______ _______ ______ ________ ______ _________ ___________ ____________ _________ _______ 17-Apr-2015 14:42:05 1.4293e+09 4.8255e+08 4689.6 15622 1061 {'osion'} 513.43 11.05 70.841 -45.944 34.7 2 333.36 0.42428 550 -3.6646 0.05477 {'SCP'} 17-Apr-2015 14:42:12 1.4293e+09 4.8255e+08 4696.6 15622 1061 {'osion'} 506.66 11.065 71.03 -45.583 34.308 2 666.75 0.84859 550 -3.1451 0.038727 {'SCP'} 17-Apr-2015 14:42:15 1.4293e+09 4.8255e+08 4699.6 15622 1061 {'osion'} 503.78 11.071 71.111 -45.427 34.14 2 481.56 0.61289 550 -3.2284 0.04557 {'SCP'} 17-Apr-2015 14:42:17 1.4293e+09 4.8255e+08 4701.6 15622 1061 {'osion'} 501.86 11.075 71.164 -45.323 34.027 2 259.35 0.33008 550 -3.4387 0.062095 {'SCP'} 17-Apr-2015 14:42:20 1.4293e+09 4.8255e+08 4704.6 15622 1061 {'osion'} 498.99 11.081 71.244 -45.167 33.859 2 370.4 0.47141 550 -3.4785 0.05196 {'SCP'} 17-Apr-2015 14:42:23 1.4293e+09 4.8255e+08 4707.6 15622 1061 {'osion'} 496.12 11.087 71.323 -45.011 33.69 2 185.25 0.23578 550 -3.2106 0.073471 {'SCP'} 17-Apr-2015 14:42:26 1.4293e+09 4.8255e+08 4710.6 15622 1061 {'osion'} 493.27 11.093 71.402 -44.855 33.52 2 555.57 0.70709 550 -3.2106 0.042426 {'SCP'} 17-Apr-2015 14:42:29 1.4293e+09 4.8255e+08 4713.6 15622 1061 {'osion'} 490.42 11.099 71.481 -44.698 33.352 2 518.56 0.65999 550 -3.1294 0.043914 {'SCP'} 17-Apr-2015 14:42:32 1.4293e+09 4.8255e+08 4716.6 15622 1061 {'osion'} 487.59 11.105 71.559 -44.54 33.182 2 592.67 0.7543 550 -3.1048 0.041077 {'SCP'} 17-Apr-2015 14:42:35 1.4293e+09 4.8255e+08 4719.6 15622 1061 {'osion'} 484.76 11.111 71.637 -44.383 33.011 2 518.56 0.65999 550 -3.1291 0.043914 {'SCP'} 17-Apr-2015 14:42:37 1.4293e+09 4.8255e+08 4721.6 15622 1061 {'osion'} 482.87 11.115 71.689 -44.278 32.898 2 370.4 0.47141 550 -2.8854 0.05196 {'SCP'} 17-Apr-2015 14:42:40 1.4293e+09 4.8255e+08 4724.6 15622 1061 {'osion'} 480.06 11.121 71.766 -44.12 32.727 2 888.95 1.1314 550 -2.6833 0.03354 {'SCP'} 17-Apr-2015 14:42:43 1.4293e+09 4.8255e+08 4727.6 15622 1061 {'osion'} 477.25 11.127 71.843 -43.961 32.557 2 629.66 0.80139 550 -2.6833 0.039852 {'SCP'} 17-Apr-2015 14:42:46 1.4293e+09 4.8255e+08 4730.6 15622 1061 {'osion'} 474.45 11.133 71.92 -43.803 32.386 2 926.02 1.1786 550 -2.6833 0.032862 {'SCP'} 17-Apr-2015 14:42:49 1.4293e+09 4.8255e+08 4733.6 15622 1061 {'osion'} 471.66 11.139 71.996 -43.644 32.214 2 518.56 0.65999 550 -3.2306 0.043914 {'SCP'} 17-Apr-2015 14:42:52 1.4293e+09 4.8255e+08 4736.6 15622 1061 {'osion'} 468.88 11.145 72.072 -43.485 32.043 2 592.67 0.7543 550 -3.4348 0.041077 {'SCP'}
[t1,t2] = bounds(T1{:,1})
t1 = datetime
17-Apr-2015 14:42:05
t2 = datetime
17-Apr-2015 15:06:16
Col1 = T1.t_utc - T1.t_utc(1)+seconds(0.001); % Create 'duration' Array
[h,m,s] = hms(Col1); % Get Components
Col1_CumTime = cumsum(diff([0; m]) < 0)*60 + s; % Convert To Cumulative Seconds
% [h1,h2] = bounds(Col1_CumTime)
figure
semilogx(Col1_CumTime, T1.t_sclk)
grid
xt = xticks;
idx = ceil(linspace(1, size(T1,1), numel(xt)));
xticklabels(string(T1.t_utc(idx))) % Assign Labels
.
  6 Comments
Sonali
Sonali on 8 Nov 2023
do you mind removing my program and the datafile from your comments please?
Star Strider
Star Strider on 8 Nov 2023
O.K. I deleted the files, however kept everything else intact.

Sign in to comment.

Categories

Find more on Line Plots 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!