Jump to content

find the 1st element which is larger zero in an array


GSR

Recommended Posts

Dear all,

I am converting my Matlab code into LabVIEW block diagram because my current computer does not have Matlab. I have a few lines of matlab code to find the 1st element which is larger zero in an array, but I have no idea how to convert it into LabVIEW block diagram.

I used flag and if-else in Matlab, so "" if (flag is not ON and array>0)"" can give me the result. I was trying to use the case structure to replace the if-else structure in the Matlab code, but the case structure has to connect to output for both true and false conditions. :wacko: Any suggestion?

btw, can you see my personal photo under my name zmarcoz on the left column? if not, what should I set to display my picture?

Link to comment

If I have understood correctly you need to update a flag under certain conditions and retain the previous value of the flag for remaining conditions. Assuming that you are using a while loop or a for loop you can do this by using a shift register. Update the shift register when you need to set your flag and for all other cases of the case structure simply pass the previous value of the shift register.

As you need to stop on the first time the condition is met, you should look at the for loop with break

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.