LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to delete columns from a 2D array

Hi guys,

I read a matrix from a text file and I want to delete the first and last columns of the matrix. I've been trying to do it with delete from an array function but it doesn't do it the way I want. Any suggestions?

0 Kudos
Message 1 of 16
(15,125 Views)

Hello Elnaz7,

 

Here's one way to do it.

temp.png

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 2 of 16
(15,119 Views)

Thanks but this deleted the very first row instead of column.

0 Kudos
Message 3 of 16
(15,115 Views)

my mistake, that was for deleting rows... here's the column one...

temp.png

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
Message 4 of 16
(15,108 Views)

Yes, it works, thank you.

Now another question: If I want to feed this data to another module row by row for example in a for loop how should I do that?

0 Kudos
Message 5 of 16
(15,104 Views)

drop a "for loop" on theram and  Block diagram and look for the help. (CTRL+H). There are some good examples also available so that you can be familiar with using the for loops.

 

Guru

 

 

Regards
Guru (CLA)
0 Kudos
Message 6 of 16
(15,088 Views)

Keep in mind that by default, 2-D LabVIEW arrays are row-based. So though you might be thinking that the first indexing input for the 'index array' primitive is for columns, it is actually for rows. You can either select the second input for the 'index array', or, if you are like me and think better in columns, you can transpose the array before you operate on it. I recommend getting used to the order of the inputs for the array tools and forcing yourself into the LabVIEW convention, as it gets complicated if you need to invert an array before you operate on it, and then again after so that the array returns to row-centric order, which is what all the rest of the LV array tools are expecting


Good luck!

--------------------------------------------------------------------------------------
Wes Ramm, Cyth UK
CLD, CPLI
0 Kudos
Message 7 of 16
(15,070 Views)

Hi Elnaz7,

 

Have you researched some of our examples and tutorials for manipulating clusters and arrays?  

Here is a tutorial I feel you should go through: http://zone.ni.com/devzone/cda/tut/p/id/7571 

 

Regional Account Manager
NI
0 Kudos
Message 8 of 16
(15,038 Views)

hi

 how to delete  rows from  2d array.Those rows which are having number of ones(1) greater than a certain number has to be deleted.Can you please help me

0 Kudos
Message 9 of 16
(13,797 Views)

Hi dfsfdsfv,

 

Check whether this meets your requirements.

 

 

______________________________________________
Kudos are welcome
0 Kudos
Message 10 of 16
(13,787 Views)