MATLAB Answers

i have two arrays in matlab code and i want to plot them by two lines on the same graph

4 views (last 30 days)
Momen AlManaseh
Momen AlManaseh on 10 Jul 2021
Edited: Soniya Jain on 10 Jul 2021
i have two arrays in matlab code and i want to plot them by two lines on the same graph

Answers (1)

Soniya Jain
Soniya Jain on 10 Jul 2021
You can use plot function,
plot(Array1);
hold on;
plot(Array2);
hold off;
hold will retain current plot when adding new plots.
  4 Comments
Soniya Jain
Soniya Jain on 10 Jul 2021
I guess you are trying to plot cell array as using {}, which is invalid argument in plot function, so you can first covert cell array to vector using or str2double functions, and then try plotting.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by