LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1d array substitute

Hi,
I have a 1d array and want to subsitute all negative numbers with a mark.
Whats the best and fastest way of doing this?
Thank you
0 Kudos
Message 1 of 9
(3,068 Views)
Hi RJP,

two questions:
What kind of array (datatype)?
What kind of mark?

General algorithm:
1) do a comparison "<0" and the full array, resulting in a boolean array
2) for loop with your 1d array and the boolean array as indexing inputs: in the loop you do a replacement depending on the boolean value, autoindexing enabled for output

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,066 Views)
- It's a 1D Waveform(DBL)
- A mark linke "N" (For negative)
0 Kudos
Message 3 of 9
(3,060 Views)
Hi RJP,

so you have to convert your DBL array to a string array and do the replacements in the string array. For conversion you can use "number to fractional string"...

The example shows how to do it - but you will get memory problems with very big DBL arraysSmiley Wink


Message Edited by GerdW on 02-15-2008 09:09 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(3,050 Views)
I have LabVIEW 8.2, How can I open your VI which is version 8.5 ?
Thanks
0 Kudos
Message 5 of 9
(3,047 Views)
You cannot do it with a waveform if you want the data as strings.
 
Here's one way, starting with the Y component array of the waveform....
modify as needed. 🙂


Message Edited by altenbach on 02-15-2008 12:41 PM
Message 6 of 9
(3,041 Views)
What is that function that you used in your false case?
0 Kudos
Message 7 of 9
(3,028 Views)
"number to fractional string".
 
 
Another possibility would be to keep the output DBL and just change to NaN for negative numbers.
Just wire across the false case and use a NaN DBL diagram constant in the true case..
This would be cheaper. 😉
Message 8 of 9
(3,019 Views)
Thanks altenbach, Worked GREAT
0 Kudos
Message 9 of 9
(2,967 Views)