Issues creating a scatter graph

23 Ansichten (letzte 30 Tage)
Nathan
Nathan am 9 Okt. 2025 um 11:31
Beantwortet: Star Strider am 9 Okt. 2025 um 13:27
I was trying to make a scatter graph for the data I had with the code shwon below:
A= readtable("query.csv");
Depth= A(:,4);
Magnitude= A(:,5);
x= table2array(Depth);
y= table2array(Magnitude);
X=mean(x,"all");
Y= median(x,"all");
Z= range(x,"all");
V= std(Magnitude);
[minA, maxA]= bounds(Magnitude,"all")
S= std(Magnitude);
X
Y
Z
S
scatter(Depth, Magnitude)
However when I run the code, Matlab resonds with the error message:
>> scatter(Depth, Magnitude)
Error using scatter (line 68)
Not enough input arguments.
I am not sure why it says I don't have enough inputs when both variables are clearly defined earlier in the code. Can anyone help with why this happens?
Many thanks
  1 Kommentar
Stephen23
Stephen23 am 9 Okt. 2025 um 11:57
Please show us the complete output from this command:
which scatter -all
/MATLAB/toolbox/matlab/graphics/graphics/scatter.m /MATLAB/toolbox/matlab/bigdata/@tall/scatter.m % tall method

Melden Sie sich an, um zu kommentieren.

Antworten (2)

dpb
dpb am 9 Okt. 2025 um 12:00
Depth and Magnitude are both tables, not the variables in the table.
scatter(A.Depth,A.Magnitude)
See the table "See Also" link <Access Data in Tables> for how to use the table directly.

Star Strider
Star Strider am 9 Okt. 2025 um 13:27
Use curly braces {} to access data in a table --
Depth= A{:,4};
Magnitude= A{:,5};
That also avoids using the table2array calls (that return x and y, not 'Depth' and 'Magnitude').
.

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by