Error in plotting multiple datasets in one graph

조회 수: 1 (최근 30일)
Jocelyn Kenley
Jocelyn Kenley 2022년 6월 13일
댓글: Image Analyst 2022년 6월 13일
I am trying to plot multiple datasets into one graph. This is the code:
clear
%% Read File
Data=csvread('SC_MX_JK2_CH1_fixture.csv');
x=Data(:,1);
y1=Data(:,2);
Data=csvread('SC_MX_JK2_CH1.csv');
y2=Data(:,2);
%% Max Value and Low Value
Min1=min(y1);
Max1=max(y1);
Min2=min(y2);
Max2=max(y2);
%% Percentile
% P1=prctile(x,y1);
% P2=prctile(x,y2);
%% Graph Values
figure1=figure('Color',[1 1 1]);
xlabel('Ewe/V vs SCE','FontWeight','bold','FontSize',20);
ylabel('<I>ma','FontWeight','bold','FontSize',20);
plot(x,y1,x,y2,'--','Color',[0,0,0],'LineStyle','none');
This is the error code that I keep recieving:
Error using plot
Vectors must be the same length.
Error in Electrochemical (line 22)
plot(x,y1,x,y2,'--','Color',[0,0,0],'LineStyle','none');
  댓글 수: 1
Image Analyst
Image Analyst 2022년 6월 13일
It's what it says: your x and y don't have the same sizes. Sadly though you delayed an answer/fix/solution because you forgot to attach the two CSV files. Please do so after reading this link:

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by