Function Problem that Include Workspace and Assignin
5 ビュー (過去 30 日間)
古いコメントを表示
Hi guys,
Here is my writer code that use for calling functions. I use just 9964x1 double vector named "pd" to start all these functions.
Writer code:
clc;
clear global;
bandpassfilter(pd)
waveletdenoiser(bandpassfilter)
ssimer(pd,bandpassfilter,waveletdenoiser)
maxer_miner(pd,bandpassfilter,waveletdenoiser)
scaler(waveletdenoiser,ratio_range_pd_waveletdenoiser)
two_d_plotter(pd,bandpassfilter,waveletdenoiser,scaler)
For example my bandpassfilter functions is;
function bandpassfilter(pd)
bandpassfilter = bandpass(pd,[20 490], 1000);
assignin('base','bandpassfilter',bandpassfilter);
But if I don't use assignin('base','bandpassfilter',bandpassfilter); ,
I can't go other functions. Beacause such as the next functions is;
function waveletdenoiser(bandpassfilter)
bandpassfilter2 = bandpassfilter;
waveletdenoiser = wdenoise(bandpassfilter2, 10,'Wavelet','coif1', 'DenoisingMethod',{'FDR',0.1}, 'NoiseEstimate','LevelDependent');
and include the previous output from previous function "bandpassfilter".
I don't want to use assignin code to don't show all these just show scaler.
Thank you.
0 件のコメント
採用された回答
Steven Lord
2020 年 6 月 12 日
Don't use assignin and global variables.
Define your functions to return output arguments and call your functions with output arguments instead.
Also don't try to use the same name for your function and your variables.
theFilter = bandpassfilter(pd);
theDenoiser = waveletdenoiser(theFilter)
ssimer(pd,theFilter,theDenoiser)
maxer_miner(pd,theFilter,theDenoiser)
theScaler = scaler(theDenoiser,ratio_range_pd_waveletdenoiser)
two_d_plotter(pd,theFilter,theDenoiser,theScaler)
I don't know which of your function computes the ratio_range_pd_waveletdenoiser variable, but whichever one does should return it. Here's a general outline of how your bandpassfilter function should look:
function F = bandpassfilter(pd)
% Compute F using pd here
F = sum(pd); % replace with your actual commands
% When the code above calls bandpassfilter, whatever you define F to be in here
% will be stored in the theFilter variable when bandpassfilter finishes executing
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!