Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Hello, i want to plot graph and workout area under that graph, i m doing it by polyarea function, but certain errors are generated, pls help?

1 回表示 (過去 30 日間)
Tare
Tare 2016 年 4 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Here i attached file also, and what program i have type in m file is mention below, Program: load FDR_0.2.mat; dp=6000:8000; %(dp i have mentioned here bcz i want to plot a graph for only data range between 6000:8000) c=x(dp);d=F1(dp); A=polyarea(c,d); figure, plot(c,d)
this is error which i have got, Undefined operator '+' for input arguments of type 'cell'.
Error in polyarea (line 42) (y([2:siz(1) 1],:) + y(:,:)))/2),[1 siz(2:end)]);
Error in F (line 7) A=polyarea(c,d);
please Help me out. thnx in advanced

回答 (1 件)

Orion
Orion 2016 年 4 月 20 日
Hi,
In your mat file, F1 and V1 are cells, not arrays. A cell is an object that can contain numbers, strings, ... there is no sense to "add" cells.
you need to extract the data you want from your cell, or convert it directly.
something like that :
load FDR_0.2.mat;
dp=6000:8000;
c=x(dp);
d=cell2mat(F1(dp)); % convert in array
A=polyarea(c,d);
figure, plot(c,d)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by