Error- Not enough input arguments when tried to plot data extracted from a table

Hi,
I tried importing data from excel into a variable of datatype table
from that I extracted two different columns using bewlo commands
Freq= Data{2:121,3}
ExpectedPow= Data{ 2:121,6}
when I tried to plot Freq v/s Expected Pow its throwing an error 'Not enough input arguments'
In the workspace I can see it took Expected pow as 120*1 categorical and Freq as 120*1 string.
Can you please help on how to plot this?

4 件のコメント

madhan ravi
madhan ravi 2018 年 12 月 27 日
Mind uploading the required data ?
N/A
N/A 2018 年 12 月 27 日
編集済み: N/A 2018 年 12 月 27 日
Each line of this data is of below format
'2' "" "18550" '3' "" '23.0'
'2' "" "18576" '3' "" '23.0'
where 18550 is freq and 23.0 is expected power
I have taken all frq's into one variable and exopected pow into one variable using above mentioned commands. I am facing error when I tried to plot freq v/s expected power.
Walter Roberson
Walter Roberson 2018 年 12 月 27 日
please show the plot call.
N/A
N/A 2018 年 12 月 27 日
plot(Freq,ExpectedPow)

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

回答 (1 件)

madhan ravi
madhan ravi 2018 年 12 月 27 日
Just a guess:
Freq = str2double(Data{2:121,3});
ExpectedPow = str2double(Data{2:121,6});
plot(Freq,ExpectedPow)

6 件のコメント

N/A
N/A 2018 年 12 月 27 日
Thanks madhan. It worked . I am able to see the plot but the range of x-axis and y-axis is 0 to 1. Wheras, Here frequency range(i.e x axis ) is from 18550 to 19050 and Expected power(i.e y axis) from 20 to 30. How can I change the axis limits in the figure?
madhan ravi
madhan ravi 2018 年 12 月 27 日
編集済み: madhan ravi 2018 年 12 月 27 日
N/A
N/A 2018 年 12 月 27 日
I have given the limts as per data but still unable to see the values in the figure .It is blank. PFA figure.
madhan ravi
madhan ravi 2018 年 12 月 27 日
upload your data
madhan ravi
madhan ravi 2018 年 12 月 27 日
thaduru shivani's answer moved here for consistency:
Attached the data file
madhan ravi
madhan ravi 2018 年 12 月 27 日
編集済み: madhan ravi 2018 年 12 月 27 日
Here you go!
T=readtable('data.xlsx');
a=T{:,end};
Freq=T{:,3};
ExpectedPower = str2double(strrep(a, '''', ''));
plot(Freq,ExpectedPower)
xlim([18550 19050]) % alter the limits according to your needs
ylim([20 30])
Note: Matlab modifies the variable names a bit in order to make it a valid name.
Not a surpise that you will get a graph with horizontal line because the y values are constant (only 2 points are there in the file).

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

質問済み:

N/A
2018 年 12 月 27 日

編集済み:

2018 年 12 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by