08-18-2021 12:06 AM
Hi All,
I am reading a file which have 2 column but I am interested only in the first one. The entries in the first column varies. My example file has 2 columns and 6 rows means I have 6 values to deal with. I can access these values individually by using 6 index array functions (please see the attached figure how I am doing it). The problem is, if I have 10 rows to deal with next time, I will have to put 10 index array functions. Looking for a clever way of doing it. Is there any way that the number of rows define how many array function I need instead of manually adding them in the code everytime.
Secondly I want to store 6 of them in two different files, Let say 1,3,5 row going into file 1 and row 2,4,6 go into file 2. Is it possible to do that?
Regards,
Solved! Go to Solution.
08-18-2021 01:24 AM - edited 08-18-2021 01:47 AM
Hi Hassan,
@HassanIqbal wrote:
Is there any way that the number of rows define how many array function I need instead of manually adding them in the code everytime.
Use an autoindexing FOR loop…
@HassanIqbal wrote:
Secondly I want to store 6 of them in two different files, Let say 1,3,5 row going into file 1 and row 2,4,6 go into file 2. Is it possible to do that?
Yes.
(You want to decimate an array…)
Btw. learn to write more descriptive thread titles than just "Hi". The thread title should reflect the problem in some simple words…
08-18-2021 01:32 AM
A couple of comments on posting on the forum:
- You are best off putting a description of what you are asking in your post title, rather than a generic Hi. It makes it easier for other people to find your post and benefit from the answers.
- Post actual code rather than pictures, this way people can open you code to see exactly what you are doing, this also makes it easier for people to modify your code and send it back to you to point you in the right direction. In your case I would also post an example data file as well
It depends slightly on how you want to display your results and how the deposition rate is entered by your user. The simplest way would be to use a for loop. This iterates through the rows of a 2D array, so if you also have your deposition rate as an array as well and wire both to the for loop it will iterate through both. Not the best explanation, but see the attached file.
Just make sure that your deposition rate array has the same number of elements as you have rows in your data