How to transform into a script matlab ?

1 view (last 30 days)
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
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.
saiful irfan
saiful irfan on 27 Jun 2015
Edited: saiful irfan on 27 Jun 2015
The only explanation
I mean I just wanted to take a minute of the clock (save time)

Sign in to comment.

Accepted Answer

Walter Roberson
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)

Community Treasure Hunt

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

Start Hunting!