How to bring my time varying workspace data to if else loop in matlab program editor?
Show older comments
ref is my workspace data and given as input to matlab function.
This is not working as i need!
I'm using matlab function
Program:
function betaref = fcn(ref)
min=1500;
max=150000;
for t=0:0.1:100
if (ref==0)
y=45;
elseif (ref>max)
y=90;
else
y=0;
end
betaref=y;
t=t+1;
end
4 Comments
Ameer Hamza
on 22 Mar 2020
MATLAB function cannot see the base workspace data by default. You need to pass the data as input to the function.
Drishya Dinesh
on 22 Mar 2020
Ameer Hamza
on 22 Mar 2020
How are you calling the function?
Shiva Kalyan Diwakaruni
on 24 Mar 2020
can you give examples like what is the expected output ? because it is working fine for me.
Answers (0)
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!