Error in plotting multiple datasets in one graph

3 次查看(过去 30 天)
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 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by