Error in plotting multiple datasets in one graph
3 views (last 30 days)
Show older comments
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 Comment
Image Analyst
on 13 Jun 2022
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:
Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!