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 个评论

Which programming language is that? I do not recognize
take clock just minute
from any of the languages I have encountered.
The only explanation
I mean I just wanted to take a minute of the clock (save time)

请先登录,再进行评论。

 采纳的回答

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.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by