How to plot a large csv file with 3 different functions to plot

조회 수: 2 (최근 30일)
Sarah Hicks
Sarah Hicks 2018년 10월 4일
댓글: KSSV 2018년 10월 4일
I have a 101x4 csv file and I am having trouble plotting the 3 lines.This is the code I have so far, can anyone tell me what I have done wrong?
if true
filename='arm_motion_1.csv'
M=csvread(filename, 2,0);
a=filename(:,1); %time in seconds
b=filename(:,2); %angular displacement
c=filename(:,3); %angular velocity
d=filename(:,4); %angular acceleration
plot(a,b,'r')
hold on
plot(a,c,'g')
hold on
plot(a,d,'b')
hold on
title('Raw Kinematics Data on Arm Flexion-Extension')
t=[0:.05:5]
end

채택된 답변

KSSV
KSSV 2018년 10월 4일
filename='arm_motion_1.csv' ;
M=csvread(filename);
a=M(:,1); %time in seconds
b=M(:,2); %angular displacement
c=M(:,3); %angular velocity
d=M(:,4); %angular acceleration
plot(a,b,'r')
hold on
plot(a,c,'g')
hold on
plot(a,d,'b')
hold on
title('Raw Kinematics Data on Arm Flexion-Extension')
t=[0:.05:5]
  댓글 수: 2
Sarah Hicks
Sarah Hicks 2018년 10월 4일
You are my new favorite person. My classmates and I love you, and wish that God blesses forever and always.
KSSV
KSSV 2018년 10월 4일
Ha ha..thanks for that.....enjoy MATLAB..happy to help you. :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by