A=readtable('samples.csv');
figure;
x= A{:,1};
y= A{:,2};
plot(x,y);
xlim([2,21601]);
ylim([2,14761]);

11 件のコメント

Stephan
Stephan 2019 年 2 月 26 日
What is the question?
madhan ravi
madhan ravi 2019 年 2 月 26 日
you forgot to upload your file
vandana sharma
vandana sharma 2019 年 2 月 26 日
it is giving "not enough argumets for plot(x,y);"
what can i do to remove this and to plot y vs x.
madhan ravi
madhan ravi 2019 年 2 月 26 日
You have a file named plot.m which shadows the inbuilt function plot() please remove it or move it from from the working path.
vandana sharma
vandana sharma 2019 年 2 月 26 日
where to find this file.....bcz as far i know there is no such file
vandana sharma
vandana sharma 2019 年 2 月 26 日
i have uploaded the .csv file now
madhan ravi
madhan ravi 2019 年 2 月 26 日
which plot -all % what shows up?
vandana sharma
vandana sharma 2019 年 2 月 26 日
Error using plot
Invalid first data argument.
Error in sample1_plot (line 5)
plot -all
madhan ravi
madhan ravi 2019 年 2 月 26 日
Stephan
Stephan 2019 年 2 月 26 日
@Madhan: I tried using readtable and get the same error - if i use csvread it works - there is problably not a problem of a shadowed function
madhan ravi
madhan ravi 2019 年 2 月 26 日
編集済み: madhan ravi 2019 年 2 月 26 日
So after testing it , turns out that all the numbers are read as char.

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

 採用された回答

Stephan
Stephan 2019 年 2 月 26 日
編集済み: Stephan 2019 年 2 月 26 日

0 投票

Hi,
try this:
A=csvread('samples.csv',2,0);
plot(A(:,1),A(:,2))
For me it works - there is no problem with your plot function i guess. It is due to the format that the readtable function gives your data when inporting it. I get the same error when i try to use readable... So do not search for a double file that is not there...
Best regards
Stephan

3 件のコメント

vandana sharma
vandana sharma 2019 年 2 月 26 日
it worked........but i want to know what does 2,0 mean in your code??
Stephan
Stephan 2019 年 2 月 26 日
編集済み: Stephan 2019 年 2 月 26 日
The first two rows are ignored and no columns are ignored when importing the data - so the imported data is only numeric, which is easier to process with.
vandana sharma
vandana sharma 2019 年 2 月 26 日
ok.
Thank you so much Stephan.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeApplications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by