Jump to content

Testimony


Recommended Posts

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.

post-10515-127619029281_thumb.png

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.

post-10515-127619016856_thumb.png

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!

  • Like 1
Link to comment

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.

post-10515-127619029281_thumb.png

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.

post-10515-127619016856_thumb.png

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

Link to comment

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.

Link to comment

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.

Link to comment

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).

post-10515-127625781462.png

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.