Francois Normandin Posted June 10, 2010 Report Share Posted June 10, 2010 After a decade of programming LabVIEW, I have to admit I still get bitten by stupid mistakes. Today's mistake is one I'd like to share because it's so simple and yet, I had to take a long lunch break to clear my head before I finally nailed it. In the pic above, I simply give the user a list of available ports and lines for a selected DAQmx device. The user selects one or multiple lines and I pass it down to create a task. And this is the solution: Using the Array to spreadsheet primitive adds a end of line at the end, which was carried an couldn't be filtered later down the road by DAQmx "Create Virtual Channel.vi". I hope to save you some pain by sharing my misfortune! 1 Quote Link to comment
Grampa_of_Oliva_n_Eden Posted June 10, 2010 Report Share Posted June 10, 2010 After a decade of programming LabVIEW, I have to admit I still get bitten by stupid mistakes. Today's mistake is one I'd like to share because it's so simple and yet, I had to take a long lunch break to clear my head before I finally nailed it. In the pic above, I simply give the user a list of available ports and lines for a selected DAQmx device. The user selects one or multiple lines and I pass it down to create a task. And this is the solution: Using the Array to spreadsheet primitive adds a end of line at the end, which was carried an couldn't be filtered later down the road by DAQmx "Create Virtual Channel.vi". I hope to save you some pain by sharing my misfortune! What threw me for a loop was turning a string into a DAQmx channel (purple wire). Did not think to just try wiring the string and let LV do the conversion. NI Support was also at a loss. Ben Quote Link to comment
crelf Posted June 10, 2010 Report Share Posted June 10, 2010 After a decade of programming LabVIEW, I have to admit I still get bitten by stupid mistakes. It's not a stupid mistake - I think it's a bug that teh Array to spreadsheet primitive adds a line at the end. Quote Link to comment
Francois Normandin Posted June 10, 2010 Author Report Share Posted June 10, 2010 It's not a stupid mistake - I think it's a bug that teh Array to spreadsheet primitive adds a line at the end. You think it's a bug? It's been adding a line at the end since I can remember. Or has it? I can't find conclusively information about if EOL is a standard termination for spreadsheet formats... What threw me for a loop was turning a string into a DAQmx channel (purple wire). Did not think to just try wiring the string and let LV do the conversion. NI Support was also at a loss. Ben Yes, I tried to connect the string directly and it didn't change a thing. I think there's a slight no difference between string and DAQmx channel/task/whatever, something I've seen only when using variants to propagate them tells me it's a XControl with string state. HEX Display is the same when you cast it to string. ***** Talk about coincidences... this VI will do it for me. Quote Link to comment
Yair Posted June 11, 2010 Report Share Posted June 11, 2010 Or simply use the OpenG 1D Array to String VI, which I believe works around this issue. 1 Quote Link to comment
Cat Posted June 11, 2010 Report Share Posted June 11, 2010 You think it's a bug? It's been adding a line at the end since I can remember. Or has it? I've been stripping the EOL off the end of the last line of spreadsheets for what seems like forever. Whether or not it's a bug, it certainly is annoying. Quote Link to comment
Francois Normandin Posted June 11, 2010 Author Report Share Posted June 11, 2010 I've been stripping the EOL off the end of the last line of spreadsheets for what seems like forever. Whether or not it's a bug, it certainly is annoying. Annoying it is, but I don't think that's gonna be changed. Let's think of how it might affect appending to text file. Or simply use the OpenG 1D Array to String VI, which I believe works around this issue. Indeed it does. OpenG to the rescue (as usual). Quote Link to comment
Cat Posted June 11, 2010 Report Share Posted June 11, 2010 Annoying it is, but I don't think that's gonna be changed. Let's think of how it might affect appending to text file. No no! I agree completely! I'm sure changing it now would result in a lot of broken code. I've got the primitive wrapped in a vi with a switch to delete the last EOL if necessary. I wrote that after being bitten a couple times by it just like François was. Quote Link to comment
Tim_S Posted June 11, 2010 Report Share Posted June 11, 2010 I hope to save you some pain by sharing my misfortune! I'm curious why you're using this method rather than using the DAQmx Flatten Channel String VI? Tim Quote Link to comment
Francois Normandin Posted June 11, 2010 Author Report Share Posted June 11, 2010 I'm curious why you're using this method rather than using the DAQmx Flatten Channel String VI? Tim Because I just noticed it existed late yesterday PM (see my status on front page). It's already replaced in my programs. 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.