Jump to content

Control that adapt any type connected


Recommended Posts

Does anyone know if its possible to create a control which adapt to the type which its wired to ?

I like to build a sub vi that takes in any data type and saves it according to this type on disk in a Matlab file format.

:headbang: I have already many bumps on my head. In this sub vi i want to use the function "flatten to string" which has an input which supports anything, this "anything" feature i want to use as a control for my sub vi.

JohnS

Link to comment
Well, a variant input can take anything you wire to it even though it doesn't technically adapt to that type.  You could at least wire the variant to the flatten function and save whatever you decide to pass in.

5872[/snapback]

Thanks for your answer, this will work i am sure.

My concern is if the data block is large (10 Mbyte onwards), that the overhead will be time consuming ?

It's difficult to imagine what the data conversion is adding (my previous saving in Ascii format cost a lot time converting from double -> Ascii and from Ascii -> double in Matlab and i lost resolution)....?

Link to comment
Thanks for your answer, this will work i am sure.

My concern is if the data block is large (10 Mbyte onwards), that the overhead will be time consuming ?

It's difficult to imagine what the data conversion is adding (my previous saving in Ascii format cost a lot time converting from double -> Ascii and from Ascii -> double in Matlab and i lost resolution)....?

5873[/snapback]

There should be some overhead when converting to variants. As a neater solution, if you have the professional version of LV, you can create a polymorphic VI, which is basically a collection of VIs with similar connector panes, but where some of the input data types are different. Once you wire in an input which exists only in one of the subVIs, that subVI is selected, similar to what happens when you wire an array of a certain type or size into an array function.

To create a polymorphic VI go to File>New and select Polymorphic VI. Now you can have one VI which will save a DBL, another which will save booleans and so on. Don't forget to include a variant one. You can save all of the VIs in a single LLB and have the polymorphic one as the top-level VI. You can also look at some of the VIs from OpenG for examples (like the Data Changed? VI).

This should at least remove the overhead involved in the conversion.

Link to comment
Thanks for your answer, this will work i am sure.

My concern is if the data block is large (10 Mbyte onwards), that the overhead will be time consuming ?

It's difficult to imagine what the data conversion is adding (my previous saving in Ascii format cost a lot time converting from double -> Ascii and from Ascii -> double in Matlab and i lost resolution)....?

5873[/snapback]

I don't see a lot of problem with overhead. Are you saving all the data at one time? Perhaps you want to change to saving line by line if using ASCII. The input to you VI can be variant, but the file save format can be something else. If you're saving as an ASCII then you will be limited to the resolution of the precision you picked in your format to string function. I would recommend using exponential notation in addition to high precision. This way you get the highest precision for the units you are using. Also, what is a MATLAB format?

Link to comment
There should be some overhead when converting to variants. As a neater solution, if you have the professional version of LV, you can create a polymorphic VI, which is basically a collection of VIs with similar connector panes, but where some of the input data types are different. Once you wire in an input which exists only in one of the subVIs, that subVI is selected, similar to what happens when you wire an array of a certain type or size into an array function.

To create a polymorphic VI go to File>New and select Polymorphic VI. Now you can have one VI which will save a DBL, another which will save booleans and so on. Don't forget to include a variant one. You can save all of the VIs in a single LLB and have the polymorphic one as the top-level VI. You can also look at some of the VIs from OpenG for examples (like the Data Changed? VI).

This should at least remove the overhead involved in the conversion.

5877[/snapback]

Hello Yen,

Yes your right, but i was lazy and i did not want to create 9 different vi's for the 9 type's i want to cover right now.

Bye the way i, like the Data Changed vi ! :D

Link to comment
I don't see a lot of problem with overhead. Are you saving all the data at one time? Perhaps you want to change to saving line by line if using ASCII. The input to you VI can be variant, but the file save format can be something else. If you're saving as an ASCII then you will be limited to the resolution of the precision you picked in your format to string function. I would recommend using exponential notation in addition to high precision. This way you get the highest precision for the units you are using. Also, what is a MATLAB format?

5881[/snapback]

Hello Michael,

What you say is what i am trying to avoid. Matlab is a Dos/Unix command like :thumbdown: matrix calculations mathematic program. This has its own binary fileformat which is used at our firm. I want to save data to that format from Labview whithout using "Matlab Script" (not in base package) which need Matlab to be installed on the computer you're working on (13000 Euro / year / licence) :blink:

Also to preserve disk space and conversion program's, my goal is to save the data in 9 type's (Double, Single int8,16,32 uint8,16,32 and string's) as variable,array's and multi dimension matrices.

On top of that, so we say in Holland, i want to use this software to wat you say "saving line by line", what i call "logging data matrix by matrix in one of the 9 type's" although this is not at all supported by the Matlab file format....

If i succeed i have my "tjakka !!!" moment (Every dutch knows that's a goooood moment, it has nothing to do with sex but a famous dutch mental coach is shouting that for years and years on tv)

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.