Illegal use of reserved keyword "classdef" ; How to fix it?

37 ビュー (過去 30 日間)
Anika Sharma
Anika Sharma 2020 年 11 月 14 日
回答済み: Steven Lord 2020 年 11 月 15 日
THIS is the code, but I cant seem to figure out why it shows (below) when I try to run the section
classdef SalsaSpectrum<handle
Error: Illegal use of reserved keyword "classdef".
function handle = plot(obj, varargin)
% HANDLE = PLOT(obj,varargin)
%
% Plot a spectrum. The default syntax
%
% spec.plot()
%
% By default the velocity scale is used. Other options are
% 'pix' for indices and 'freq' for frequency.
%
% spec.plot('freq')
%
% If you have fitted Gaussians, they will also be
% displayed.
%
% If a second 'dummy' argument is supplied, and gaussians have
% been fitted, the individual Gaussians will be shown.
%
% spec.plot('vel', 'dummy')
clf
hold on
box on
%grid on
fff = 7;
set(gca, 'fontsize', fff)
ff = fff;
if ~isempty(varargin)
type = varargin{1};
else
type = 'vel';
end
  2 件のコメント
Matt J
Matt J 2020 年 11 月 14 日
We would really need to see the whole file that this resides in.

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

回答 (1 件)

Steven Lord
Steven Lord 2020 年 11 月 15 日
If you're trying to run this by copying and pasting the code into the Command Window, that won't work. You need to construct the object by calling SalsaSpectrum with the appropriate inputs. Since the function's signature is:
function spec = SalsaSpectrum(fname)
you need to call SalsaSpectrum with one input, whatever the help text says fname should be, and one output.

カテゴリ

Help Center および File ExchangeHandle Classes についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by