How to transform into a script matlab ?
1 view (last 30 days)
Show older comments
saiful irfan
on 27 Jun 2015
Commented: saiful irfan
on 27 Jun 2015
I have examples of scripts that I've made, but I do not know how to change to a script that can be accepted by MATLAB
aa = area;
cc = clock;
waktu = cc;
if aa>500
if waktu = 0 then waktu = cc
save time;
selisih=cc - save time;
if selisih > 180000
alarm
end
end
else
waktu=0
end
2 Comments
Walter Roberson
on 27 Jun 2015
Which programming language is that? I do not recognize
take clock just minute
from any of the languages I have encountered.
Accepted Answer
Walter Roberson
on 27 Jun 2015
aa = area;
cc = clock;
waktu = cc;
if aa>500
if isequal(waktu,0)
waktu = cc;
save_time = clock;
selisih = etime(cc,save_time); %result is in seconds
if selisih > 180000
disp('alarm');
end
end
else
waktu = 0;
end
I have no idea what you intended for "area" so I left that alone. "alarm" is pretty vague so I just had it display the string.
There are a number of problems with your logic, but this is the implementation of what you wrote.
Amongst other problems: you asked to take cc minus the time that was just saved. cc was saved earlier so it is going to be a lower time value. A lower time value minus the current time value is going to be negative, and so will never be greater than 180000.
More Answers (0)
See Also
Categories
Find more on Clocks and Timers in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!