unable to plot columns of multiple cells
Show older comments
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)
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,t2] = bounds(T1{:,1})
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
on 7 Nov 2023
That is entirely different from what you originally wrote.
Calculating the mean of the ‘abundance’ values with respect to altitude is relatively straightforward using the accumarray function —
T1 = readtable('mvn_ngi_l2_ion...8_v08_r01.csv')
figure
plot(T1.alt, T1.abundance)
grid
xlabel('Altitude')
ylabel('Abundance')
title('Original Data')
[Ualt,~,idx] = unique(T1.alt); % Unique 'alt' Values
mean_abundance = accumarray(idx, (1:size(T1,1)).', [], @(x)mean(T1.abundance(x))); % Mean Of 'abundance' Values At Each Altitude
sem_abundance = accumarray(idx, (1:size(T1,1)).', [], @(x)std(T1.abundance(x))/sqrt(numel(x))); % Standard Error Of The Mean Of 'abundance' Values At Each Altitude
figure
plot(Ualt, mean_abundance)
% hold on
% plot(Ualt, [-1 1]*1.96.*sem_abundance+mean_abundance, '--r')
% hold off
grid
xlabel('Altitude')
ylabel('Mean Abundance')
title('Accumulated Data (linear)')
figure
semilogx(Ualt, mean_abundance)
% hold on
% plot(Ualt, [-1 1]*1.96.*sem_abundance+mean_abundance, '--r')
% hold off
grid
xlabel('Altitude')
ylabel('Mean Abundance')
title('Accumulated Data (log(x))')
Make appropriate changes to get the desirred results.
.
Sonali
on 8 Nov 2023
Star Strider
on 8 Nov 2023
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Sonali
on 8 Nov 2023
Star Strider
on 8 Nov 2023
O.K. I deleted the files, however kept everything else intact.
Categories
Find more on Creating and Concatenating Matrices 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!


