LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search and replace elements of an array

Hello there, I am new to LABview . can anyone help me with the block diagram of search and replacing element in an array?

Thanks a lot

0 Kudos
Message 1 of 6
(4,610 Views)

Look at the training resources on the top of the forum. See how far you get and if you get stuck, come back with a more specific questions.

 

(Also note how to spell LabVIEW with the correct letter case. Make sure to include all information. Is this a string or a numeric array? Where does it come from? What should happen with the result? How does it fit into the rest of your code?)

0 Kudos
Message 2 of 6
(4,592 Views)

1D Array, 2D array or 3D array?

Text number or boolean?

What is the size of the array?

Be specific so we can help you.

Benoit

0 Kudos
Message 3 of 6
(4,543 Views)

@akshay321 wrote:

Hello there, I am new to LABview . can anyone help me with the block diagram of search and replacing element in an array?

Thanks a lot


Search and Replace.png

 

Assuming a 1D array, and integers. Store this in a .vim, and it will work for any type.

0 Kudos
Message 4 of 6
(4,530 Views)

wiebe@CARYA wrote: 

Assuming a 1D array, and integers. Store this in a .vim, and it will work for any type.


Yes, we still have to assume way too much. Your code searches and replaces all matching elements, while the OP was talking about "element" (i.e. not plural).

Without assuming anything, the current question cannot be uniquely answered. For example if it is just an U8 array, it could be temporarily converted to a string for a loop free version to replace all matches. If the array is DBL, we need to worry about failures of "equal" comparisons (A search only finds a match if the values are binary identical) and we might need protective code.

 

In any case, if the OP is still around, he might want to clarify the question as already requested.

0 Kudos
Message 5 of 6
(4,514 Views)

@altenbach wrote:

wiebe@CARYA wrote: 

Assuming a 1D array, and integers. Store this in a .vim, and it will work for any type.


Yes, we still have to assume way too much. Your code searches and replaces all matching elements, while the OP was talking about "element" (i.e. not plural).

Without assuming anything, the current question cannot be uniquely answered. For example if it is just an U8 array, it could be temporarily converted to a string for a loop free version to replace all matches. If the array is DBL, we need to worry about failures of "equal" comparisons (A search only finds a match if the values are binary identical) and we might need protective code.

 

In any case, if the OP is still around, he might want to clarify the question as already requested.


You're right, it was just a "best guess".

0 Kudos
Message 6 of 6
(4,496 Views)