Illegal use of reserved keyword
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
akj
el 12 de Abr. de 2018
Comentada: Monojit Chatterjee
el 12 de Sept. de 2020
function PLAYNOTE(app,frequency)
FreqString=num2str(frequency);
app.Label.Text=FreqString;
%https://www.mathworks.com/help/signal/ug/edit-time-information-in-the-signal-analyzer-app.html
%below details can be obtained from the above mentioned websites./
SampleRate = app.samplerate;
TimeValue = app.timevalue;
TimeSamples = 0:SampleRate:TimeValue;
FORSINE=app.SINE.Value;
FORSQUARE=app.SQUARE.Value;
FORSAWTOOTH=app.SAWTOOTH.Value;
if FORSINE == 1
soundVector = sin(2*pi*frequency*TimeSamples);
elseif FORSQUARE == 1
soundVector = square(2*pi*frequency*TimeSamples);
elseif FORSAWTOOTH == 1
soundVector = sawtooth(2*pi*frequency*TimeSamples);
end
sound(soundVector, 1/SampleRate)
CheckRecord=app.RECORD.Value;
if CheckRecord == 1
SOUNDCOMPOSE=app.Soundvector;
if SOUNDCOMPOSE == 0
SOUNDCOMPOSE=soundVector;
else
SOUNDCOMPOSE=cat(2,SOUNDCOMPOSE,soundVector);
end
app.Soundvector=SOUNDCOMPOSE;
end
end
methods (Access = private)%showing error at this line....Illegal use of reserved keyword"methods"
0 comentarios
Respuesta aceptada
Steven Lord
el 12 de Abr. de 2018
This looks like a portion of an App Designer app, and if it is that is indeed a classdef file. Looking at the end keywords, the last one before the methods line ends the function. There is no end ending the previous methods block. You can't start a methods block inside another methods block.
end the methods block that contains PLAYNOTE before starting another one for your private methods.
0 comentarios
Más respuestas (1)
Guillaume
el 12 de Abr. de 2018
Editada: Guillaume
el 12 de Abr. de 2018
Unless that function is in a larger file which is a class definition (i.e. the very first line of the file except for comments is classdef something, then yes that methods ... line is illegal.
Since it doesn't sound that your file is a class definition (otherwise you'd have said, I hope), what exactly were you hoping to achieve with that method line?
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!