Plot two columns from a table error

plot( t.x, t.y );
Output:
Error using plot
Too many input arguments.
Where t.x and t.y are 50000x1 double

Réponses (1)

What do these next 2 lines show in your command window?
whos t
which -all plot
built-in (/MATLAB/toolbox/matlab/graph2d/plot) /MATLAB/toolbox/matlab/graphics/math/@digraph/plot.m % digraph method /MATLAB/toolbox/matlab/graphics/math/@graph/plot.m % graph method /MATLAB/toolbox/matlab/timeseries/@timeseries/plot.m % timeseries method /MATLAB/toolbox/matlab/graphics/math/@polyshape/plot.m % polyshape method /MATLAB/toolbox/matlab/graphics/math/@alphaShape/plot.m % alphaShape method /MATLAB/toolbox/matlab/bigdata/@tall/plot.m % tall method /MATLAB/toolbox/bioinfo/bioinfo/@phytree/plot.m % phytree method /MATLAB/toolbox/bioinfo/microarray/@HeatMap/plot.m % HeatMap method /MATLAB/toolbox/bioinfo/microarray/@clustergram/plot.m % clustergram method /MATLAB/toolbox/curvefit/curvefit/@cfit/plot.m % cfit method /MATLAB/toolbox/curvefit/curvefit/@sfit/plot.m % sfit method /MATLAB/toolbox/econ/econ/@conjugateblm/plot.m % conjugateblm method /MATLAB/toolbox/econ/econ/@diffuseblm/plot.m % diffuseblm method /MATLAB/toolbox/econ/econ/@mixconjugateblm/plot.m % mixconjugateblm method /MATLAB/toolbox/econ/econ/@lassoblm/plot.m % lassoblm method /MATLAB/toolbox/econ/econ/@mixsemiconjugateblm/plot.m % mixsemiconjugateblm method /MATLAB/toolbox/econ/econ/@empiricalblm/plot.m % empiricalblm method /MATLAB/toolbox/econ/econ/@blm/plot.m % blm method /MATLAB/toolbox/econ/econ/@customblm/plot.m % customblm method /MATLAB/toolbox/econ/econ/@semiconjugateblm/plot.m % semiconjugateblm method /MATLAB/toolbox/ident/ident/@iddata/plot.m % iddata method /MATLAB/toolbox/ident/nlident/@idnlarx/plot.m % idnlarx method /MATLAB/toolbox/ident/nlident/@idnlhw/plot.m % idnlhw method /MATLAB/toolbox/mpc/mpc/@mpc/plot.m % mpc method /MATLAB/toolbox/robust/rctobsolete/robust/@frd/plot.m % frd method /MATLAB/toolbox/robust/robust/@umargin/plot.m % umargin method /MATLAB/toolbox/shared/channel/rfprop/@propagationData/plot.m % propagationData method /MATLAB/toolbox/shared/drivingscenario/@drivingScenario/plot.m % drivingScenario method /MATLAB/toolbox/signal/signal/@dspdata/plot.m % dspdata method /MATLAB/toolbox/stats/bayesoptim/@BayesianOptimization/plot.m % BayesianOptimization method /MATLAB/toolbox/stats/classreg/@LinearModel/plot.m % LinearModel method /MATLAB/toolbox/wavelet/wavelet/@dtree/plot.m % dtree method /MATLAB/toolbox/wavelet/wavelet/@wdectree/plot.m % wdectree method /MATLAB/toolbox/wavelet/wavelet/@ntree/plot.m % ntree method
x = [1:5000]';
y = sin(2 * pi * x / 1000);
t = table(x, y)
t = 5000×2 table
x y __ _________ 1 0.0062831 2 0.012566 3 0.018848 4 0.02513 5 0.031411 6 0.03769 7 0.043968 8 0.050244 9 0.056519 10 0.062791 11 0.06906 12 0.075327 13 0.081591 14 0.087851 15 0.094108 16 0.10036
plot(t.x, t.y); % See No error if you do it right.

4 commentaires

Niko
Niko le 31 Mai 2023
I restarted Matlab and it started to work... Thank you for the answer tho.
Image Analyst
Image Analyst le 31 Mai 2023
Too bad you didn't use "which" like I said. You must have had your own version of plot that you defined somehow. When you restarted MATLAB you didn't define your own version that time and so it used the default buil-in version of plot(), which works.
Niko
Niko le 1 Juin 2023
interesting...
So this is what I get from which
built-in (C:\Program Files\MATLAB\R2022b\toolbox\matlab\graph2d\plot)
C:\Program Files\MATLAB\R2022b\toolbox\matlab\bigdata\@tall\plot.m % tall method
C:\Program Files\MATLAB\R2022b\toolbox\matlab\graphics\math\@alphaShape\plot.m % alphaShape method
C:\Program Files\MATLAB\R2022b\toolbox\matlab\graphics\math\@digraph\plot.m % digraph method
C:\Program Files\MATLAB\R2022b\toolbox\matlab\graphics\math\@graph\plot.m % graph method
C:\Program Files\MATLAB\R2022b\toolbox\matlab\graphics\math\@polyshape\plot.m % polyshape method
C:\Program Files\MATLAB\R2022b\toolbox\matlab\timeseries\@timeseries\plot.m % timeseries method
C:\Program Files\MATLAB\R2022b\examples\wavelet\data\@edwttree\plot.m % edwttree method
C:\Program Files\MATLAB\R2022b\examples\wavelet\data\@rwvtree\plot.m % rwvtree method
C:\Program Files\MATLAB\R2022b\examples\wavelet\data\@wvtree\plot.m % wvtree method
C:\Program Files\MATLAB\R2022b\toolbox\bioinfo\bioinfo\@phytree\plot.m % phytree method
C:\Program Files\MATLAB\R2022b\toolbox\bioinfo\microarray\@clustergram\plot.m % clustergram method
C:\Program Files\MATLAB\R2022b\toolbox\bioinfo\microarray\@HeatMap\plot.m % HeatMap method
C:\Program Files\MATLAB\R2022b\toolbox\coder\half\@half\plot.p % half method
C:\Program Files\MATLAB\R2022b\toolbox\curvefit\curvefit\@cfit\plot.m % cfit method
C:\Program Files\MATLAB\R2022b\toolbox\curvefit\curvefit\@sfit\plot.m % sfit method
C:\Program Files\MATLAB\R2022b\toolbox\ident\ident\@iddata\plot.m % iddata method
C:\Program Files\MATLAB\R2022b\toolbox\ident\nlident\@idnlarx\plot.m % idnlarx method
C:\Program Files\MATLAB\R2022b\toolbox\ident\nlident\@idnlhw\plot.m % idnlhw method
C:\Program Files\MATLAB\R2022b\toolbox\robust\rctobsolete\robust\@frd\plot.m % frd method
C:\Program Files\MATLAB\R2022b\toolbox\robust\robust\@umargin\plot.m % umargin method
C:\Program Files\MATLAB\R2022b\toolbox\shared\channel\rfprop\@propagationData\plot.m % propagationData method
C:\Program Files\MATLAB\R2022b\toolbox\signal\signal\@dspdata\plot.m % dspdata method
C:\Program Files\MATLAB\R2022b\toolbox\stats\classreg\@LinearModel\plot.m % LinearModel method
C:\Program Files\MATLAB\R2022b\toolbox\wavelet\wavelet\@dtree\plot.m % dtree method
C:\Program Files\MATLAB\R2022b\toolbox\wavelet\wavelet\@ntree\plot.m % ntree method
C:\Program Files\MATLAB\R2022b\toolbox\wavelet\wavelet\@wdectree\plot.m
Image Analyst
Image Analyst le 1 Juin 2023
Yeah, that all looks fine. They're just overloaded versions of plot. But you don't want to see something like
c:\users\NIKO\Documents\matlab\work\plot.m
which is some version of your own creation.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Discrete Data Plots dans Centre d'aide et File Exchange

Produits

Version

R2022b

Question posée :

le 19 Mai 2023

Commenté :

le 1 Juin 2023

Community Treasure Hunt

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

Start Hunting!

Translated by