Why is my GUI program producing an error when I 'Run' it?

2 views (last 30 days)
SampleEntropyのコードです。太字の部分、SampleEntropyが定義されていない、とエラーが出ます。どのように対処すればよいでしょうか?
%% SAMPLE ENTROPY
COP=COP';
%% Downsampling to 100 Hz (if Fs>100); see explanation in data analysis section of main paper
if Fs>100
Ratio = Fs/100;
COP_resample=resample(COP,1,Ratio);
else
COP_resample = COP;
end
%% Calculation of sample entropy of the anterior-posterior (y) and mediolateral (x) COP time series.
% Defining SEn parameters
m=3;
r=0.01;
%Calculating estimates and errors (latter are not used)
N_COP_x = (COP_resample(:,1)-(mean(COP_resample(:,1))))/var(COP_resample(:,1));
N_COP_y = (COP_resample(:,2)-(mean(COP_resample(:,2))))/var(COP_resample(:,2));
[SEN_x,err_x]=sampleEntropy(N_COP_x,m,r);
[SEN_y,err_y]=sampleEntropy(N_COP_y,m,r);
% SEn_total = SEN_total(length(SEN_total),1);
SEn_x = SEN_x(length(SEN_x),1);
SEn_y = SEN_y(length(SEN_y),1);

Accepted Answer

Kojiro Saito
Kojiro Saito on 7 Mar 2023
sampleEntropyという関数がMATLABの検索パスに入っていないためです。
sampleEntropy.mファイルがあるフォルダーをaddpathで検索パスに追加すれば実行できるようになると思います。
  9 Comments
Kojiro Saito
Kojiro Saito on 9 Mar 2023
コメントで記載したコードではaddpathはフォルダー名を指定しています。ファイル名ではなくフォルダー名を引数に入れるので
addpath('C:\Users\megan\OneDrive\デスクトップ\914\データ\1yama\cop\SampEn')
が正しいです。
康二 中西
康二 中西 on 9 Mar 2023
ありがとうございました。
無事結果が出ました。
丁寧にご返答頂き大変助かりました。

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!