필터 지우기
필터 지우기

Error using tabular/plot too many input arguments

조회 수: 8 (최근 30일)
Jake keogh
Jake keogh 2021년 1월 29일
댓글: Image Analyst 2021년 2월 1일
my code for plotting the table is:
if team == 2
Rawdata = readtable('liverpool.xlsx');
x = Rawdata(:,4);
y = Rawdata(:,5);
figure;
plot(x,y);
end
Where i am displayed an error,
I am aware that tables can not be used to plot now, however I can not find a solution around this,
Thanks for any help.

채택된 답변

Image Analyst
Image Analyst 2021년 1월 29일
Use braces instead of parentheses:
% Create sample data.
v1 = sort(rand(10, 1))
v2 = rand(10, 1);
t = table(v1, v2);
% Plot column 2 vs. column 1.
plot(t{:, 1}, t{:, 2}, 'b.-', 'LineWidth', 2);
Braces get you the contents of the table. Parentheses get you a 1-column table, not a 1 column vector of doubles.
  댓글 수: 2
Jake keogh
Jake keogh 2021년 2월 1일
Thank you!
Image Analyst
Image Analyst 2021년 2월 1일
Jake, if it worked, could you accept the answer? Thanks in advance.
Here is the FAQ and it will give you a good idea of when to use braces, brackets, and parentheses:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by