Info

This question is closed. Reopen it to edit or answer.

How can i run the loop of the function with many other sub functions

1 view (last 30 days)
I am very new in MATLAB and cannot understand that how can i set my function in a loop. Appreciate if anyone can help me.
khan.m # suppose function name
Inputs of the function are the following
Y1=zahid(a); # zahid.m is a sub function with input argument “a” in main function khan.m.
Y2=shahid(b);# shahid.m is a sub function with input argument “b” in main function khan.m.
Y3=data1(:,3);# third column of the function data.m as a input argument (suppose size of this vector is 122 by 1).
Output of the function is following
R # a vector of measurements of size 122 by 1.
Now i want to check the some condition over the vector R and if that condition is true then want to update the vector Y3 only ,having the other inputs same. For example
if max(R)>3 # suppose the condition which i have to check.
j = find(R==max(R), 1); # find the index of maximum value of vector R.
Y3-Y3(j), update the vector Y3 such that delete measurement “j” from vector Y3.
else
stop # if above condition is not true stop the looping of the function khan.m
Note: I do not understand that how can i repeat khan.m if the above condition suppose remain true up to 5 times and i will continue update the vector Y3 i.e after five runs there will be 117 observation in Y3.

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!