I keep getting error using plot not enough input arguments. I need help

19 ビュー (過去 30 日間)
Belinda tee
Belinda tee 2018 年 10 月 17 日
コメント済み: madhan ravi 2018 年 10 月 17 日
I keep getting error when I try to plot the following code and I don't really know what I'm doing wrong.
data = readtable('instr_04_01.csv');
load = data.Extension(2:89);
displacement = data.Load(2:89);
figure
plot(load, displacement)
the error I keep getting is;
Error using plot
Not enough input arguments.
  2 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 17 日
Upload csv file
Belinda tee
Belinda tee 2018 年 10 月 17 日
sorry about that... there's the csv file

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2018 年 10 月 17 日
You aren't extracting the numbers correctly. Also load is expecting arguments and you're giving it an equal sign instead of a filename. DO NOT USE A BUILT-IN FUNCTION FOR YOUR VARIABLE NAME.
Try this:
filename = 'instr_04_01.csv'
data = readtable('instr_04_01.csv', 'ReadVariableNames', true)
theLoad = str2double(data.Extension(2:end));
displacement = str2double(data.Load(2:end));
plot(theLoad, displacement, 'b-', 'LineWidth', 2)
grid on;
title(filename, 'FontSize', 15, 'Interpreter', 'none');
xlabel('Load', 'FontSize', 15);
ylabel('Displacement', 'FontSize', 15);
  2 件のコメント
Belinda tee
Belinda tee 2018 年 10 月 17 日
thank you so much for this :)
madhan ravi
madhan ravi 2018 年 10 月 17 日
+1 learn't something new

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by