Matlab code problem in a S-function

1 Ansicht (letzte 30 Tage)
alessandro
alessandro am 29 Jun. 2014
Kommentiert: Image Analyst am 29 Jun. 2014
Hi, I have this loop in my code:
global counter
T=200
if counter>=T
counter=0
.
.
else counter=counter+1
end
This code worked fine yesterday and now no, but I have not changed anything. Until yesterday, the answer was
counter =
1
.
.
counter =
200
and now:
counter =
[]
.
.
counter =
[]
Please help me

Akzeptierte Antwort

Image Analyst
Image Analyst am 29 Jun. 2014
When you enter the routine counter is null for some reason. Probably some other part of your code did it. Change the line
if counter>=T
to this
if isempty(counter) || counter >= T
That should make it not null anymore.
  2 Kommentare
alessandro
alessandro am 29 Jun. 2014
perfect, it works. Thank you
Image Analyst
Image Analyst am 29 Jun. 2014
Can you mark the Answer as "Accepted" then? Thanks.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by