Can Someone help me with Parse error at function in my matlab code ?
Mostra commenti meno recenti
% Find a VISA-GPIB object.
obj1 = instrfind('Type', 'visa-gpib', 'RsrcName', 'GPIB8::1::INSTR', 'Tag', '');
% Create the VISA-GPIB object if it does not exist
% otherwise use the object that was found.
if isempty(obj1)
obj1 = visa('TEK', 'GPIB8::1::INSTR');
else
fclose(obj1);
obj1 = obj1(1);
end
% Connect to instrument object, obj1.
fopen(obj1);
%// Initialize a cell array
results = {};
%// Define a function to be called when the timer fires
function timerCallback(varargin)
newresult = query(obj1,'CALCulate:SPECtrum:MARKer0:Y?');
%// Display the result (like you currently are)
disp(newresult)
%// Append the result to your results container
results{end+1} = newresult;
end
%// Then set your timer callback
t = timer('TasksToExecute', 3, ...
'Period', 30, ...
'ExecutionMode', 'FixedRate', ...
'TimerFcn', @timerCallback);
start(t)
The above is my code.
I was getting error at line function timerCallback saying that " Parse error at FUNCTION:Usage might be invalid matlab syntax ".
Can someone tell me how to fix this error?
And also I was getting warning at line results{end+1}=newresult; Saying that " The value assigned to variable results might be unused.
If possible let me know how to rectify it.
Expecting answers as early as possible. Thank you in advance !!

Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Waveform Generation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
