How do I make a script which can call for other scripts for every x time interval?

1 view (last 30 days)
I would like to know the syntax for calling for different scripts for every x intervals in my main script ? How do i achieve that ?

Answers (2)

KSSV
KSSV on 16 May 2018
Read about functions in MATLAB. You need to write your script into a function and save it. Every time you can call this function and use. EXample, check the below pseudo code.
function result = mysum(input)
% This function takes input and adds 2 to the input
result = input+2 ;
end
Save the above function...it will be saved as mysum. Now calling the function.
x = 0:1:100 ;
N = length(x) ;
iwant = zeros(size(x)) ;
for i = 1:N
iwant(i) = mysum(x(i)) ; % call the function here
end

Steven Lord
Steven Lord on 16 May 2018
You probably want to use a timer object.

Community Treasure Hunt

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

Start Hunting!