how to define class for basic functions like disp, load save

i am calling classdef in a program and once called basic functions like disp, save, load does ot work. do i need to define any class for them. pl. guide

댓글 수: 7

Do you mean that the default disp, save, and load do not work for your class? Could you clarify? Depending on your class and its properties, you might need to implement your own load/save logic. However, I would expect disp to "work" by default.
Thanks Jake for the reply. i am not sure why it is happening. i called one class using classdef, the current is o able to call disp, save or load which it should. is there any function which can block all this functions. in that case i can search in other inherited classes. Note: when i create a new file disp/save/load function works.
I am not clear... is it the case that you have a .m file that has regular functions and also has a classdef inside it? A classdef needs to be in a file of its own.
i have a m file which uses classdef on the top of code, now when i use disp/save/load, it does not work and give compilation error
Please post more detailed, what you are doing. "use disp" is not clear enough to understand, where a compilation error comes from. Do you get an error message?
thanks all for your comments. attached is the sample file where i am not able to call default functions.
Matt J
Matt J 2014년 1월 26일
편집: Matt J 2014년 1월 26일
I am not clear... is it the case that you have a .m file that has regular functions and also has a classdef inside it? A classdef needs to be in a file of its own.
That's not precisely true, Walter. A classdef file can contain sub-functions.

댓글을 달려면 로그인하십시오.

답변 (2개)

Matt J
Matt J 2014년 1월 26일
편집: Matt J 2014년 1월 26일
When I run your code, I have no problem displaying invoking the default disp.
>> obj=vrt_gen; disp(obj)
vrt_gen with properties:
hdr: []
trailer: []
word0: []
psize: []
stream: 0
int_ts: []
frac_ts_0: []
frac_ts_1: []
count: []
nSamples: []
nPkts: []
pkt: []
pkts: []
payload: []
lpf: []
symbols: []
dsymbols: []
M: []
N: []
fs: []
ts: []
fc: []
time: []
upsample: []
mixed: []
filt_y: []
filt_t: []
filt_type: []
filt_beta: []
filt_Fd: []
filt_Fs: []
scheme: []
h: []
g: []
filtered_sig: []
What is the full path to your main_file.m?
Image Analyst
Image Analyst 2014년 1월 26일

0 개 추천

You don't have any methods in your class. And disp() doesn't even appear anywhere in the file. No, you do not need a class to use disp, save, and load. You can use them just by themselves. Not sure what you're doing tor attempting to do.

카테고리

도움말 센터File Exchange에서 Class Introspection and Metadata에 대해 자세히 알아보기

질문:

2014년 1월 17일

답변:

2014년 1월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by