Extracting values from an Array

  • 421 Views
  • Last Post 06 November 2018
  • Topic Is Solved
Sawan posted this 02 November 2018

Hello Members,

I have an array A (4 rows and 1 col), which contains numbers (eg. 15, 20, 45, 5). These number represent the element number of my meshed geometry. I want to select the the elements with these number i.e 15th, 20th, 45th and 5th element. I am using *do loop with esel command to select these particular elements but cant select all of them. My final purpose is to kill these element from analysis by ekill command. So this selection is necessary.

The code which i have for this task is:

esel,s,,,A(1,1)

*do,i,2,4,1

esel,a,,,A(i,1)

*enddo

PS. I know it can be done manually, but for the sake of simplicity I have presented this example. In real, I have an array with more than 100 rows.

Any suggestion for a better method to make this selection or improvisation in my way of doing it would help me a lot.

Many Thanks. 

Order By: Standard | Newest | Votes
jpasquerell posted this 02 November 2018

Instead of a do loop you can use an implied do.  It only works for the row subscript though.

esel,s,,,A(1,1)

esel,a,,,A(2:4,1) 

Sawan posted this 03 November 2018

Thanks. Works like a charm.

kkanade posted this 06 November 2018

Great. Can you please mark this as 'Is Solution' to help others on forum. 

Close