11-23-2012 03:33 AM
hi everyone,
in matlab there is a special function called find(x) that find indices and values of nonzero elements, how can i do the same thing in Labview, anyone have ideas or ever did this?
thanks!
11-23-2012 04:11 AM
Non-zero element means any number or a single value you want to find? In Array you have search 1D array which does similar thing what you want. Gives you the index where the value is (x)
11-23-2012 04:39 AM - edited 11-23-2012 04:41 AM
As Anand writes, Search 1D Array is definetly an option. But this works out for integer, boolean or strings properly, but not for floating point numbers directly.
But i doubt, that find(x) in MatLab can handle a float x properly without pre-analysis....
So if working with floats, you should do something like this:
hope this helps,
Norbert
11-23-2012 04:43 AM - edited 11-23-2012 04:56 AM
If you have LabVIEW 2012 you can use the Conditional Tunnel Mode to recreate the basic find(X) functionality. If yu don't have 2012 you will need to create the logic that builds the 2 arrays on the output of the For loop.
Here is another version my coffee induced creativity came up with:
11-23-2012 05:28 AM
Or you could even do it this way:
11-23-2012 05:42 AM
I need to post to the forums more often. After my earlier post I received the following personal message via the NI Discussion Forums:
"God bless you I am Miss. Veronica the director of bill furthermore at the foreign remittance department of SG-SSB Bank Limited, board of administrator en route for my bank mandated me to look for least known relative of our late client he deposited in our bank sum of fourteen million five hundred thousand dollars, send a mail to my private email address (loveveronica17@gmail.com or loveveronica17@gmail.com) so that I can explain more details to you, please acknowledge my mail, Best regards, Miss.Veronica"
11-23-2012 05:51 AM
Strange PM.... would report that to moderators.
Regarding the posted suggestions:
Please don't post code/images of code where you compare floating point numbers with direct equal or not equal functions. In most cases, it works, but not in every case (2!=2 might return true for instance)!
thanks,
Norbert
11-23-2012 06:26 AM
@DavidCorney wrote:
I need to post to the forums more often. After my earlier post I received the following personal message via the NI Discussion Forums:
"God bless you I am Miss. Veronica the director of bill furthermore at the foreign remittance department of SG-SSB Bank Limited, board of administrator en route for my bank mandated me to look for least known relative of our late client he deposited in our bank sum of fourteen million five hundred thousand dollars, send a mail to my private email address (loveveronica17@gmail.com or loveveronica17@gmail.com) so that I can explain more details to you, please acknowledge my mail, Best regards, Miss.Veronica"
I got the same PM. Cheers 😄
11-23-2012 07:50 AM
@Norbert_B wrote:
Strange PM.... would report that to moderators.
Regarding the posted suggestions:
Please don't post code/images of code where you compare floating point numbers with direct equal or not equal functions. In most cases, it works, but not in every case (2!=2 might return true for instance)!
thanks,
Norbert
Maybe I am being dense, Norbet, but you lost me when it comes to comparing a floating point numbers.
In my mind a number is zero, or not zero, irrespective of data type and digits of precision. Why would the equal and not equal to zero functions fail with floating point numbers? If you are suggesting they should never be used with floating point numbers, that is going to confuse the heck out of a lot of LabVIEW users, especially the less numerically sophisticated (me).
Can you explain your logic in simpler terms for me? Thanks.
11-23-2012 09:31 AM