I have a data set mentioned below
I want to make a custom plot with respect to time showing different activities(starting,moving,stopping) with different colors. an anyone help me please

댓글 수: 2

Stephen23
Stephen23 2018년 5월 28일
@Girish Kanika: please upload sample data (in a .mat file) by clicking the paperclip button.
"I want to make a custom plot with respect to time "
What kind of plot: a line plot, a scatter plot, a bar plot, ...? Which column contains the time data?
Girish Kanika
Girish Kanika 2018년 5월 28일
편집: Girish Kanika 2018년 5월 28일
this is my matfile. i want to make line plot. time data is in first column. Can you help me please.

댓글을 달려면 로그인하십시오.

 채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 28일
편집: Ameer Hamza 2018년 5월 28일

0 개 추천

You can use to plot the required graphs
c2 = splitapply(@(x) {x}, c(2:end,:), findgroups(c(2:end,end)));
titles = {'accX', 'accY', 'accZ', 'Average'};
for ii=1:4
f = figure;
ax = gca;
hold(ax);
title(titles{ii});
for jj=1:length(c2)
plot([c2{jj}{:,1}], [c2{jj}{:,ii+1}], 'DisplayName', c2{jj}{1,end})
end
legend()
end

댓글 수: 7

Image Analyst
Image Analyst 2018년 5월 28일
I think he wanted separate plots for each (not all 4 on the same graph), and for each plot to have different colors in each time segment depending on the word in column 6 (starting, stopping, moving).
Girish Kanika
Girish Kanika 2018년 5월 28일
Yes Image Analyst is right I want to see the plot like this as shown in fig
But thankyou people for your responses.
Ameer Hamza
Ameer Hamza 2018년 5월 28일
Please refer to the updated answer.
Girish Kanika
Girish Kanika 2018년 5월 28일
Thankyou
Regards
Girish
Girish Kanika
Girish Kanika 2018년 5월 29일
Hi @Ameer Hamza I tried your code I couldn't get how the different activities are getting plotted please refer the following link:
"https://www.mathworks.com/examples/matlab/community/32165-human-activity-classification-based-on-smartphone-sensor-signals#14"
I couldn't get how the "plotAccelerationColouredByActivity(t, acc, actid, {'Vertical acceleration'},actlabels)" this is done.
Ameer Hamza
Ameer Hamza 2018년 5월 29일
plotAccelerationColouredByActivity(), is not a MATLAB built-in function. This function is part of the Sensor Data Analytics Webinar. In order to use that function, you will need to download and place in MATLAB path.
Girish Kanika
Girish Kanika 2018년 5월 29일
Thankyou So much got it now..
Regards
Girish

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2018년 5월 28일

댓글:

2018년 5월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by