how to convert table to cell to acess data?

4 ビュー (過去 30 日間)
ramya
ramya 2024 年 3 月 4 日
コメント済み: the cyclist 2024 年 3 月 5 日
filename = 'Book11.csv';
M = readtable(filename);
a=M(:,3);%phi
b=90;
f=unique(M(:,1)); %freq
rcs=M(:,4);
ys = smooth(rcs,10);
Error using ()
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).

Error in smooth (line 91)
y = y(:);
plot(a,rcs,'k'); hold on; grid on
plot(a,ys,'r')
legend('original','average')
i have to import file then plot on y axis wrt rcs and x axis wrt phi for constant b for all frequencies before plotting i have smooth the data of rcs also

採用された回答

the cyclist
the cyclist 2024 年 3 月 4 日
編集済み: the cyclist 2024 年 3 月 4 日
The syntax
rcs=M(:,4)
will give a one-column table.
The syntax
rcs=M{:,4}
will give a column of data of the class that is stored in the table. I think that's what you want.
filename = 'Book11.csv';
M = readtable(filename);
a=M{:,3};%phi
b=90;
f=unique(M(:,1)); %freq
rcs=M{:,4};
ys = smooth(rcs,10);
plot(a,rcs,'k'); hold on; grid on
plot(a,ys,'r')
legend('original','average')
(I have not tried to solve why you don't get the graph you expected here.)
  2 件のコメント
prabhu singh
prabhu singh 2024 年 3 月 5 日
I hv to take 50% percentile of rcs and smooth the data by using windowsize and slideangle.
the cyclist
the cyclist 2024 年 3 月 5 日
OK. We've solved your problem of how to access table data. I suggest you accept this answer, and post a new question specifically on the data you have, and how to smooth it.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by