Bob Edwards Posted April 14, 2010 Report Share Posted April 14, 2010 I'm working towards a Labview 7.1 app that would be a bridge between Excel and a small network of Labrad test instrument servers ( http://en.wikipedia.org/wiki/LabRAD ). Spreadsheet as general purpose test controller in other words, with program steps stored as excel comments. Labrad supports arbitrarily complex data, described as a string e.g. (b*3s) = cluster of binary and 3d string array. To support this, the labrad interface uses labview variants. It seems logical to stick with variants for the excel interface, to keep it general purpose. By adapting Jim Kring's 'Universal Probe' http://vi-lib.com/news/UniversalProbe-LabVIEWdat.html, I'm able to pass any labview variant into excel. (User layout choices to follow eventually) Anybody any hints on going the other way - assembling the values pulled from excel into a labview variant? Inputs are (1) the labrad string describing the data (2) labview data from the individual spreadsheet cells. Pulling the data out of excel is already working, it's assembling the required variant using a string formula that seems tricky. I suspect the variant will have to be constructed byte by byte - but would some of the openg variant vis help? Being self-taught, the application of some of these is obscure. After cracking this hurdle, I hope to include it in my existing code with an added 'data direction' input. I already know of NI App Note 154, http://openg.org/docs/LabVIEW%20Data%20-%201%20of%202.pdf and the openg variant examples on sourceforge. Cheers, Bob Quote Link to comment
Bob Edwards Posted April 14, 2010 Author Report Share Posted April 14, 2010 As usual when you ask a question, you may end up seeing the answer yourself. I wonder if the attached vi is the sort of thing I'll need to do - albeit the inputs are embedded in the adapted 'Universal Probe' as vis pulling the data from excel? Bob Variant at runtime test.vi Quote Link to comment
Bob Edwards Posted April 14, 2010 Author Report Share Posted April 14, 2010 No, the code is nonsense. It was supposed to (say) allow the user to create a variant containing cluster of numeric, string and binary or any other combination. Instead it produces a cluster of variants. Quote Link to comment
Yair Posted April 14, 2010 Report Share Posted April 14, 2010 Since you have the OpenG VIs, you can have a look at the variant config VIs. The one which reads a cluster from the file builds a variant cluster based on the input cluster and you can then convert that variant to your data type. As you point out, this can be somewhat complicated. You should note that it also uses type descriptors which have been changed in LV 8.x and have been made private, so going forward this isn't necessarily a very good idea if you plan on upgrading. If you are thinking of upgrading, you could look at MGI's read-write anything VIs, which do a similar action, but use VIs which are shipped with LV in 8.x. Quote Link to comment
dannyt Posted April 15, 2010 Report Share Posted April 15, 2010 I already know of NI App Note 154, http://openg.org/doc...01%20of%202.pdf and the openg variant examples on sourceforge. Cheers, Bob Thanks for the post to this App Note I found it an interesting reading. Does anybody know if the part 2 of 2 ever get written and if so does anyone have a copy of it or a link to it please ? Dannyt Quote Link to comment
Ton Plomp Posted April 15, 2010 Report Share Posted April 15, 2010 Editing your code in the following way in the 'cluster' should fix your code: My code shows the edits in the array state, which should be in the cluster state. Remember that an array must have the same datatypes for all elements. Ton Quote Link to comment
Bob Edwards Posted April 15, 2010 Author Report Share Posted April 15, 2010 Yair - Thanks for the hints. I'd tried converting the MGI 'read/write anything to file' down to labview 7.1. I got a lot of bad vi messages, so I expect it's the new features you mention that aren't backward compatible. I'll look at those vis more closely as to the technique used. Avoiding being locked into 7.1 is a very good idea, though - so I need to be cautious in any bit-banging approach taken. DannyT - I've not come across 'LabVIEW Data (2 of 2) in several searches Ton - thanks for that - I removed the array (as you say it makes no sense) - and your code then produces the cluster, so that would be useful as part of the conversion process. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.