11-22-2006 07:29 AM
11-28-2006 04:07 PM
Hello David,
Hope you had a nice Thanksgiving. And I'm back to work after a nice vacation.
Alright, I have an excel file here that I'm having trouble reading. I'm using ActiveX to read the spreadsheet and it works fine with other spreadsheets except for this one. I can read the same file contents from other excel sheets. Tried changing the extension(to .xls) and reading it without any luck. Is there any way I can read this type of excel file like any other spreadsheet...?
Secondly, I'm having 2 2D arrays. I would like to compare the first frist 4 columns of both the arrays. Like first four column elements of first row(1st array) with first 4 column elements of all the rows in 2nd array..., first four column elements of second row(1st array) with first 4 column elements of all the rows in 2nd array and so on.. If they match I want the corresponding rows(with all elements) from both the arrays to be pulled out as a 1D array and build a 2D array for all the matches. I would like to know the best way to do it. I greatly appreciate your help.
Thank you very much
Have a wonderful night
Shaun
11-29-2006 03:27 AM
Thank you! Unfortunately I had to work as we don't celebrate Thanksgiving here in Scotland but its good to hear you had a good holiday none the less. Any way moving on ...
Sorry, I don't know why you can't read the xls file but that doesn't stop us having a look at it. I noticed that the excel spreadsheet has a macro. Does that make this xls file different from the others? If so it could be your Macro Security is set very high. If you post the code you use to read the xls file you posted I could take a look at.
You can compare two 2D arrays using the Equals? in comparison palette. It will return a 2D array of booleans that will contain True in each index that match in both arrays.
12-05-2006 08:13 AM
Hello David,
I didn't know you were from Scotland. Home of the Brave Heart..!( as the movie depicts). How is the weather like over there..? We are have a snow storm out here..!
I'm attaching the vi i'm using to read the my macro enabled excel file. Please have a look and let me know if there's any changes that I have to make in the "Excel Get Data Specified Field.vi" to be able to read excel file that I have.
And also attaching vi I was able to make for array column comparison(Row match.vi). I'm kinda stuck at dynamic indexing the matched rows and building an array in the required format. An example that shows the requirement is as shown in the word document. I would be thankful if you can correct my code as per my requirement.
Thank you
Have a Nice Day..!
Shaun
12-05-2006 12:00 PM
Good movie! Really dodgy accent though. The weather here has been wild, wet and windy but mild for the time year according to bloke who does the weather on the telly.
Your VI to get the data from excel was broken in a couple of places (Open invoke, and you need to use Value2 and ot Value) so I fixed that. You will need to be carefull about closing activex references in the reverse order you create them. This VI locks access to the file that was opened and read using your VI so that might be your issue. I needed to exit labview to access the excel file again. So thats something for you to look at.
I have attached a VI to do the row matches for you. It would have been helpful if you supplied a VI with data already in the tables.
David
12-12-2006 04:23 PM
12-20-2006 03:09 AM
Hi Shaun
Sorry I haven't been back to you sooner as I have been away on business.
I see you have started a new thread here http://forums.ni.com/ni/board/message?board.id=170&message.id=220599 and received some more help from the boys in blue.
If you don't get an answer within reasonable time to your current thread then by all means "bump" it to bring it to the top for attention. I think this is better than starting a new thread on the same subject. That way when you bump the thread up the community can see the history of your questions to help you better.
On the subject of modifying the VIs with your requirements. So far I have given you plenty of detailed help so far to get you started. I was actually hoping you would be learning something along the way and be able to make the modifications yourself. If I keep doing the work for you then I feel you won't learn anything.
Is there any aspect so far that you are not sure about?
About your question on opening excel files with macro security level set very high. My earlier reply was just a hunch so I just tried Excel Macro Example.vi with Excel Macro Security Level set Very high with no issues so it might be something else causing your issue when opening your file.
I am very happy to help you along the labview journey but not do the all the work for you.
Happy Holidays!
David
12-20-2006 08:07 AM
David,
Sorry if I've annoyed you by starting a new thread. I sincerely appreciate all the help you have given me and I'm very thankfull to you aswell.
Happy Holidays
Merry Christmas
Shaun
12-20-2006 08:22 AM
Thanks Shaun.
Me!
Annoyed?
No way!
You have absolutely nothing to apologise for. It was just some advice on how to get the best learning experience from the forum.
All the best!
David
01-03-2007 02:26 PM