LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find and replace several array elements

I have a 2d array and want to subsitute any negitive value with a marker e.g "**" or any indicator which would be identified easily. I am using Labview 5.1
0 Kudos
Message 1 of 7
(3,805 Views)
Dear Gorelick,

I attached a small vi that does just that. It is a 'Quick-and-Dirty' code that checks the values of your 2d array and replace them with a 'NaN' (Not a Number) mark.
I am sure there are other ways to do it, but this method is very simple so that you can customise it for your own needs.

Hope this helps,

Elie Allouis
0 Kudos
Message 2 of 7
(3,805 Views)
Thanks for your help, but I was unable to load this vi, code error 8. I am using Labview 5.1 could this be the problem??
0 Kudos
Message 3 of 7
(3,805 Views)
Hi,

The data type of you array is probably numerical. If you haven't already
done this, the first step would be to convert the data to a character
data type. This is easy done with 'Number to Decimal String'. Tie the
output to a 'For Loop' and the search and modify each element in the
array using a combination of 'Search 1D Array', 'Replace Array Subset',
and shift registers.

The first iteration of the 'For Loop' will give you the first index of
the first '-1' found. Use that index value to replace the the '-1' with
your '**'. Increment the index and pass it to the shift register to use
as a starting point for the next interation's search and replace process.

There may be a more "packaged" way of doing this but I just love For
Loops.

Hope this helps ...


- Kevin


In article <506500000008000000D05A0000-1027480788000@exchange.ni.com>,
"Gorelick" wrote:

> I have a 2d array and want to subsitute any negitive value with a marker
> e.g "**" or any indicator which would be identified easily. I am using
> Labview 5.1
0 Kudos
Message 4 of 7
(3,805 Views)
I'm using LV 6.0 on Linux but I'm pretty sure 5.1 has it too. If it's in
the functions palette and you get an error when you try to use it, then you
could have a LV installation problem. Everything you need should be in
the String and Array libraries of the functions palette.

Perhaps LV 5.1 has some other VIs of equal value...

- Kevin

In article <5065000000050000009F9E0000-1027480788000@exchange.ni.com>,
"Gorelick" wrote:

> Thanks for your help, but I was unable to load this vi, code error 8. I
> am using Labview 5.1 could this be the problem??
0 Kudos
Message 5 of 7
(3,805 Views)
Hi all,

This sounds silghtly odd. This has been done on a mac, but there shouldn't be any compatibility problem.
If it is a version problem, I attached the same VI converted to version 5.0 of Labview....
...Hope this will cure the problem.

Cheers,

Elie Allouis
0 Kudos
Message 6 of 7
(3,805 Views)
Thanks again for your help. But there is a problem in the structure of this vi. There is a bad wire from the build array to replace array element.vi . My thoughts are that the replace array is unable to use an array but only elements, I am not sure how to modify it!
0 Kudos
Message 7 of 7
(3,805 Views)