Can't call function within class

3 ビュー (過去 30 日間)
Manash Sahoo
Manash Sahoo 2020 年 4 月 16 日
コメント済み: Cedric 2020 年 4 月 16 日
Hi everyone. First time posting here. I have a matlab class of a signal which comprises parts x, y, sampling rate (Fs), and Color. I have also defined a function within the methods of the class for resampling the signal and building a new x axis for the resampled data. However, I'm unable to call this function even after creating an object.
Using R2019b. The code is as follows:
classdef sigmoid_signal
properties
signal_x
signal_y
Fs
Color
end
methods
function resamp_x,resamp_y = resamp_sig(obj);
resamp_x = 1/obj.Fs:1/obj.Fs:numel([obj.signal_y])/obj.Fs;
resamp_y = abs(resample([obj.signal_y],[obj.signal_x],obj.Fs));
end
end
end

採用された回答

Cedric
Cedric 2020 年 4 月 16 日
You forgot to bracket the output args, and the semi-column is useless:
function [resamp_x,resamp_y] = resamp_sig(obj)
  2 件のコメント
Manash Sahoo
Manash Sahoo 2020 年 4 月 16 日
Thank you so much! What an easy mistake!
Cedric
Cedric 2020 年 4 月 16 日
Better when they are easy!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCommunications Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by