MATLAB Answers

how to extract a part of a table using logical indexing and plot a scatter figure

4 views (last 30 days)
Samaneh Arzpeima
Samaneh Arzpeima on 5 Oct 2019
Edited: Mohammad Sami on 1 Nov 2019
Hello everybody
I already ask a similar question and didn't get any answer. I am going to ask it in a different manner, hope to get some advice.
I have the duration_time.xlsx file.
I need to group he information inside it and plot with different mark and colors.
like
all the dips of 90 must be blue
all the dips of 60 must be red
all the dips of 45 must be green
types which end to "_s" must be circle
types with no "_s" must be star
I think I should make new tables and then use "hold on" to impose all on one figure.
how can I pick all the rows that their first colmn is "90"
T = readtable('duration_time.xlsx',...
'Range','A1:N16',...
'ReadVariableNames',true)
A=T.dip==90;
....
I would appreciate any help.

  0 Comments

Sign in to comment.

Answers (1)

Mohammad Sami
Mohammad Sami on 1 Nov 2019
Edited: Mohammad Sami on 1 Nov 2019
You are on the right track. You just need to use the indexing as normal.
You can check the plot documentation for the color, marker style e.t.c.
idx_90 = T.dip == 90;
T90 = T(idx_90,:);
f = figure;
hold on;
plot(T90.abc,T90.xyz) % use the variables you want to plot, specify the color and marker, check doc plot
% the rest of your indexing and plots.....

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!