05-28-2014 07:26 AM
Is there away to delete element by element in 2D array without changing the dimensions to 1D array. I want to select the first 20 element reading across the rows. For example, If I have 2D array with 6 element in each raw. I want to select the first three rows and 2 elements from the four raw.
Regards
Hussain
05-28-2014 07:33 AM
Arrays need to be ... rectangular (for lack of a better description). You can't have one row with 4 elements and a second row with 10. If you try to do this, LabVIEW will automatically populate the blank rows with a null of your array type.
05-28-2014 07:34 AM
Each row must have the same number of elements in it. Same for columns. So you can delete whole rows and/or whole columns, but not individual elements. Just use Delete From Array to do that.
05-28-2014 07:43 AM
The best way to do this is with an array of clusters of 1-D arrays. See a similar question I posted last year for more details: http://forums.ni.com/t5/LabVIEW/Uneven-2-D-Array/td-p/2497412
To summarize:
Only real solution is an array of clusters each containing another array.
05-28-2014 08:15 AM - edited 05-28-2014 08:19 AM
Maybe I completely misunderstand what the OP tried to say / do, but you can accomplish it without using clusters. Comments from others are correct, you cannot resize the 2D array by deleting elements within a given row.. However, maybe you want to achieve what is described below.
Do keep in mind that if you attempt this with a numeric array, you may want to use 0 or 'NaN' as your deleted value.
See code below which should be self-explanatory. There are probably better improvements of the example, but the purpose was simply to show how it can be done.
Array 1 shows the original 2D array and it's values.
Array 2 shows how you can "delete" or replace its element with a "deleted" value.
Array 3 shows how you can "delete" multiple elements (replace multiple elements with a "deleted" value).
05-29-2014 05:35 AM
I thank you guys for help and suggestions. I think I need to break the 2D array and delete the elements and build it again or convert to string and do the same. I was hoping for one icon solution but it seems there is no such option.
Thanks
05-29-2014 07:30 AM
It really depends what you are looking for. Can you give an example of what you want?
05-29-2014 08:48 AM
@Husain111 wrote:
I think I need to break the 2D array and delete the elements and build it again or convert to string and do the same.
I don't understand at all what you are trying to say here. What is "break"? This is not a technical term commonly used with 2D arrays.
@Husain111 wrote:
I was hoping for one icon solution but it seems there is no such option.
Of course there is, just create your own subVI. 😄