How to transform into a script matlab ?

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 commentaires

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 le 27 Juin 2015
Modifié(e) : saiful irfan le 27 Juin 2015
The only explanation
I mean I just wanted to take a minute of the clock (save time)

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 27 Juin 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.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by