Error in plotting multiple datasets in one graph

4 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by