Error using plot Invalid data argument.

10 views (last 30 days)
Arupratan
Arupratan on 21 Sep 2024
Answered: Voss on 21 Sep 2024
This is my program. Need help to solve it.
clc;
t = readtable('error graph.xlsx','Sheet','Sheet1');
x = t.ModelName;
y = t.Rmse;
z = t.R_2;
plot(x,y)
hold on
plot(x,z)
hold on

Answers (2)

Walter Roberson
Walter Roberson on 21 Sep 2024
I would guess that you need
plot(categorical(x), y)
and
plot(categorical(x), z)

Voss
Voss on 21 Sep 2024

Try replacing

x = t.ModelName;

with

x = categorical(t.ModelName);

And run the code again.

If that doesn't work, attach the xlsx file using the paperclip button.

Community Treasure Hunt

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

Start Hunting!