GSR Posted February 11, 2009 Report Share Posted February 11, 2009 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. 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? Quote Link to comment
gleichman Posted February 11, 2009 Report Share Posted February 11, 2009 QUOTE (zmarcoz @ Feb 9 2009, 08:56 PM) 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? Edit Avatar Settings QUOTE (zmarcoz @ Feb 9 2009, 08:56 PM) 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. http://lavag.org/old_files/monthly_02_2009/post-151-1234232922.jpg' target="_blank"> Quote Link to comment
JustinThomas Posted February 11, 2009 Report Share Posted February 11, 2009 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 Quote Link to comment
GSR Posted February 11, 2009 Author Report Share Posted February 11, 2009 Thanks! :thumbup: I forget I can use this function Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.