06-30-2010 09:13 AM
Hi,
I would like to use boolean array to select the columns of the index array to read from the read from spreadsheet file. As shown in the file mitdb (102).txt, I should read only column of index 4 and of index 7 (V2 and V5)!
Any help would be appreciated.
Thanks
Wasabi
Thanks
Hi,
Solved! Go to Solution.
06-30-2010 09:21 AM
You should only have to do something like this. I am not sure what the code that generates the boolean array is doing but it should work this way.
06-30-2010 09:27 AM
I don't understand the question. Your data file only has 3 columns. Where are you indexing out the 4th and 7th column? I can see that you're searching a string array for those keys, but I don't see how those index values relate to your data file. Also, why do you even need the Boolean array? All you need are the index values from the Search 1D Array function.
06-30-2010 09:58 AM
This is only a piece of my program. I would like to read the column with V2 as if it is fourth column and the V5 as if it is seventh column like the order of boolean array, all this without adding the zeros in the other columns(1,2,3,5,6,8). So i want that only array 4 and array 7 are filled.I read also from other files where I have all the 9 columns and in that case I read all and i have no problem.I don't know if I need the boolean array to do this, use it to check if there are all or some of the columns and then do some operations.
P.S. sorry for my bad english i hope you understand me!:-)
06-30-2010 11:25 AM - edited 06-30-2010 11:25 AM
So, if I understand correctly, you have a pre-allocated array of 9 columns, and you read a file. This file may contain anywhere from 1 to 9 columns, and the first line indicates which columns are in the file. You want to read the file and replace the specific columns in your Nx9 2D array. Is this correct? If so, then perhaps the following method is what you really want:
07-01-2010 04:15 AM
Thanks for your help!
This method is perfect for my problem! i have another little problem. I should pre-allocate a (File lenght)x9 2D array of zeros and then replace columns. so my final problem is in external For Loop because i should make an array 2D of zeros where the number of row is file lenght and no just a N=500 or other fixed value.
Best regards
Wasabi
07-01-2010 11:58 AM
That information can be acquired from the 2D array that is returned by the file read: