Change representation of array elements? (typecast?)

There must be a better way to convert an array of U16 (from an
unflattened picture object I loaded from a BMP file) to a floating
point array than what I've come up with: unwrapping the array,
converting each element, then building a new array! I also tried
array->cluster -> cluster convert U16 ToFloat -> array.
I can't find information on typecast - is this what I want? Where is
the "enum" definition that tells which constant to wire up to "type"?
It's not in the online help, it seems. And I couldn't find any array
conversion VI's that just change the base representation of each
element.
My ultimate goal is to load an image from disk, then display it in
various 3D ways (like a 3D graph, or contou
r, or wireframe, etc) and
apparently need the image data to be a float array to do this.
ANY advice appreciated in advance.
NO SPAM, PLEASE PLEASE!!!
Helen K
PS I have the IMAQ Vision package, the picture-control package, LabView
v6i
"I love deadlines. I like the whooshing sound as they fly by." - Douglas
Adams

d'oh! Aha! I just wrongheadedly didn't realize that the conversion vi's under
"numeric" could be used on arrays. I was hunting around in the "arrays"
palette. See, I knew there was a better way! Thanks! (Duh)
(and, doesn't the 3D graph need a float array input? Can one change that? the
help on the vi shows it as float array...?)
Torsten Levin wrote:
> In the "Numeric" palette there is a sub palette "Conversion". These
> conversion function can be used with arrays too. So where is the
> problem?
>
> "Helen E. Kourous" schrieb:
> >
> > There must be a better way to convert an array of U16 (from an
> > unflattened picture object I loaded from a BMP file) to a floating
> > point array than what I've come up with: unwrapping the array,
> > converting
each element, then building a new array! I also tried
> > array->cluster -> cluster convert U16 ToFloat -> array.
> >
> > I can't find information on typecast - is this what I want? Where is
> > the "enum" definition that tells which constant to wire up to "type"?
> > It's not in the online help, it seems. And I couldn't find any array
> > conversion VI's that just change the base representation of each
> > element.
> >
> > My ultimate goal is to load an image from disk, then display it in
> > various 3D ways (like a 3D graph, or contour, or wireframe, etc) and
> > apparently need the image data to be a float array to do this.
> >
> > ANY advice appreciated in advance.
> >
> -
> Torsten Levin Tel.: ++49-(0)89-72495-451
> Kayser-Threde GmbH Fax: ++49-(0)89-72495-291
> Perchtinger Str. 3 mailto:[email protected]
> D-81379 München http://www.kayser-threde.de
Helen E. Kourous
"I love deadlines. I like the whooshing sound as they fly by." - Do
uglas Adams

Similar Messages

  • How to change value of array element using property node

    hello all : )
    im using an array of combo-box. the size of array is not fixed.
    i want to use the strings[ ] property of combo-box to enter selection texts but since i have placed it inside the array im unable to use this property.
    i used 'arrayelem' reference property and connected property node to it but didnt got strings [ ] in the selection.
    so is there any way i can use the strings [ ] property
    Solved!
    Go to Solution.

    the picture what I posted is a snippet. It is a png file which also contains a vi:
    http://www.ni.com/tutorial/9330/en/
    I have found this post. I am just reading it:
    http://forums.ni.com/t5/LabVIEW/combobox-in-array-why-does-it-work-this-way/m-p/2146916/highlight/tr...
    It might help...
    hmm, it is more complicated as I thought )
    edit: just to be CLEAR: so you want to create a new selection LIST for each of the array elements (comboboxes)) OR you just want to set all the comboboxes to a particular value which is ALREADY in the combobox list??

  • Changing individual array element properties

    In the attached VI, I have a 1D array of slider controls ("Phase Coefficients") where each array element represents the coefficient in a polynomial of arbitrary order. The problem I'm having is that the slider range I set for the lowest order coefficient (array element 0) quickly becomes impractical for higher order coefficients (elements >5). Small changes in the higher order coefficients dramtically change the overall polynomial.  I want each element/slider to have its own range, but I know this isn't strictly possible as each element in an array shares the same properties. I've implemented a work around (Use boolean to activate) in which the range of all sliders is adjusted depending on which element is being viewed, but my implementation prevents editing of the range while running the VI. Is there any way to adapt my method (or use another method all together) to allow for different, editable ranges for each element slider?
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Arb Poly Gen.vi ‏39 KB

    Hi RavensFan, 
    Thanks for the suggestion! I tried your idea, but I still seem to be having the same problem with each slider sharing properties despite now being in a cluster inside the array. I may be misunderstanding you. Would you mind showing me an example please?
    *Edit: Nevermind, got it to work. Thanks again!
    Attachments:
    Array Cluster Slider.vi ‏7 KB

  • How to change the color of Numeric array elements (seperatel​y) programmat​ically using property node??

    For example, i have 3 numeric controls, controlling 3 numeric array elements (Numeric control is connected directly to indicator). Then if i change value in numeric control 1, then the array element No.1 of numeric array should turn red when value exceeds 5. Similarly when i change num control 2 then element 2 of array should turns red when value in num control 1 exceeds 10. Similarly for 3rd element. In other words, i want to control the property of array elements individually through seperate numeric control.
    I have done it for single numeric indicator.i.e. when i change numeric control's values then a single numeric indicator changes values and color (Numeric text BG property) but with array, the color of whole array changes but i want to change color of singles element of array.
    Please help thanks.  
    Solved!
    Go to Solution.

    ...or replace the numerics with clusters that have a numeric and a color box. make the background of the nmeric transparent and slide the color box behind the numeric. Use the color box to control the background color.
    Other alternatives would use a cluster instead of the array or if your req's are really weird "roll-your-own" with a Picture control.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Change a property of a specifc array element (array of type defs)

    If I have an array of elements, and I want to change aproperty of one specific element, at position X, is there a way to do this?
    Basically, I have an array of string indicators indicating certain tests attached to certain ports, and I want to change the text to bold on certain indicators, and i want to color certain indicators green or red.  Any chance in an array or clusters only? 
    Thanks Guys.

    While you can't change the properties for a single array element, there are solutions.
    For the background color, you can turn the array element into a cluster of your string (which would be transparent) and a color box which will be the background. You can then change the value of the color box and the color will change.
    For the bold text, I think your only option will be to get rid of the string control and make the array element a picture control instead. Using the picture VIs, you can draw a colored rectangle and then place text inside it (and each element can have different text properties). That way, you won't even need the color box.
    Try to take over the world!

  • Change array element "initialized" property

    I'm a newcomer here. And it is a simple question.
    The aim of this part is to save the array data.
    You can see that if the array element is uninitialized, it won't be saved to spreadsheet, which saves space in the disk. So can I change the "initialized" property of this array element back to unitialized?
    Thanks
    Solved!
    Go to Solution.

    You can "right-click the element...data operations...delete element".
    (This has nothing to do with "uninitialized". The size of the array is indicated by the bright elements, the dull elements are outside the valid range, which has nothing to do with the size of the container. Your first array has two elements and your second array has three elements.)
    LabVIEW Champion . Do more with less code and in less time .

  • How to set the value of an array element (not the complete array) by using a reference?

    My situation is that I have an array of clusters on the front panel. Each element is used for a particular test setup, so if the array size is three, it means we have three identical test setups that can be used. The cluster contains two string controls and a button: 'device ID' string, 'start' button and 'status' string.
    In order to keep the diagrams simple, I would like to use a reference to the array as input into a subvi. This subvi will then modify a particular element in the array (i.e. set the 'status' string).
    The first problem I encounter is that I can not select an array element to write to by using the reference. I have tried setting the 'Selection s
    tart[]' and 'Selection size[]' properties and then querying the 'Array element' to get the proper element.
    If I do this, the VI always seems to write to the element which the user has selected (i.e. the element that contains the cursor) instead of the one I am trying to select. I also have not found any other possible use for the 'Selection' properties, so I wonder if I am doing something wrong.
    Of course I can use the 'value' property to get all elements, and then use the replace array element with an index value, but this defeats the purpose of leaving all other elements untouched.
    I had hoped to use this method specifically to avoid overwriting other array elements (such as happens with the replace array element) because the user might be modifying the second array element while I want to modify the first.
    My current solution is to split the array into two arrays: one control and one indicator (I guess that's really how it should be done ;-) but I'd still like to know ho
    w to change a single element in an array without affecting the others by using a reference in case I can use it elsewhere.

    > My situation is that I have an array of clusters on the front panel.
    > Each element is used for a particular test setup, so if the array size
    > is three, it means we have three identical test setups that can be
    > used. The cluster contains two string controls and a button: 'device
    > ID' string, 'start' button and 'status' string.
    >
    > In order to keep the diagrams simple, I would like to use a reference
    > to the array as input into a subvi. This subvi will then modify a
    > particular element in the array (i.e. set the 'status' string).
    >
    It isn't possible to get a reference to a particular element within an
    array. There is only one reference to the one control that represents
    all elements in the array.
    While it may seem better to use references to update
    an element within
    an array, it shouldn't really be necessary, and it can also lead to
    race conditions. If you write to an element that has the
    possibility of the user changing, whether you write with a local, a
    reference, or any other means, there is a race condition between the
    diagram and the user. LV will help with this to a certain extent,
    especially for controls that take awhile to edit like ones that use
    the keyboard. In these cases, if the user has already started entering
    text, it will not be overwritten by the new value unless the key focus
    is taken away from the control first. It is similar when moving a slider
    or other value changes using the mouse. LV will write to the other values,
    but will not rip the slider out of the user's hand.
    To completely avoid race conditions, you can split the array into user
    fields and indicators that are located underneath them. Or, if some
    controls act as both, you can do like Excel. You don't directly type
    into the cell. You choose w
    hich cell to edit, but you modify another
    location. When the edit is completed, it is incorporated into the
    display so that it is never lost.
    Greg McKaskle

  • LabVIEW 2010 crashes when changing representation of TypeDef

    Hello NI,
    I have to report a bug
    which causes LV 2010 to crash with error in "datamgr.cpp", line 2720.
    This crash is reproduceable.I use LabVIEw 2010, 32 bit on Windows 7.
    To cause this crash you have to perform the
    following steps (I attached a sample VI to reproduce these steps.):
    Place a ring control on the FP, change
    representation to I32
    On the BD, create a property node “Strings
    And Values[]”
    The datatype of this property is Array of
    Cluster with 2 Elems, “String” & “Value”, where “Value” is of type I32
    Create a control of this property,
    surprisingly the type of Value is “extended”
    On the FP, select the cluster inside the
    array, click “Customize Control…” from Edit- menu
    In the Control- Editor change the DataType
    of Value to I32, then exit the Control Editor without saving the control,
    but replacing the original cluster
    LabVIEW 2010 will crash with the error
    message stated above
    The problem is to change the
    representation of the cluster element, where the cluster is part of a typedef. A
    solution is to forbid to call the “Customize”- editor directly from the FP (not
    nice) or to forbid to replace the orginal control, instead force the user to
    save the altered control to a .ctl (nicer).
    This shows a general problem with TypeDefs,
    where the array of a not-typedefed cluster is typedefed. This was discussed
    earlier with the cursor list of waveform graphs (couldn’t find it anymore, but
    read it in this forum) where this problem also can occur. So this is an appeal
    to National Instruments to change the TypeDef to the clusters and make arrays
    of them.
    And, after all, for me it is
    unexpected behaviour that a constant / control / indicator, created from a
    property (or any terminal / node I can find on the BD) has another datatype
    than the original terminal or node.
    Greets, Dave
    Picture 1: Type of property node
    Picture 2: Type of created control
    Picture 3: Error message
    Greets, Dave
    Attachments:
    Ring TypeDef Problem.vi ‏66 KB

    Hi All,
    I am also facing the same bug from the long time which causes loss of data unexpected.Please solve this bug and tell me any way to solve this.I am using Control Type Def in my project.
    Thanks
    Yogeshwar
    Attachments:
    error.jpg ‏19 KB

  • How do I programmat​ically modify array element sizes?

    Hi All,
    I have a quick question about modifying the size of array elements. Hopefully someone can help, because I am at a dead end!
    I am logging some intensities from a Fibre Array using a camera. For calibration of the system, I acquire an image from the camera, click points on the image to divide it into areas of interest. I overlay my image with a grid showing the regions of interst - for example a 4x6 array. I then have to select the fibres - or ROIs - I want to log from.
    I have a cluster type-def ( a number and a boolean) to specify the fibre number and to turn logging from that fibre on/off. I overlay an (transparent) array of this typedef over my image to correspond with the regions of interest. So here's my problem - I want to modify the dimensions of the array so each control matches my ROI. I can resize the elements by rightclicking on the elements on the frontpanel, but can't find a way to do it programmatically. The Array Property Node>>Array Element>>Bounds won't 'change to write'...thats the first thing I tried.
    Its really only important that the elements align with my ROIs - so programmatically adding in gaps/spacings would also work for me...but again I can't figure out how to do this! I've attached a screenshot of part of my image with array overlaid to show you all exactly what my problem is.
    Thanks in advance for you help,
    Dave
    PS I am running Labview 8.6 without the vision add on.
    Solved!
    Go to Solution.
    Attachments:
    Array_Overlay.png ‏419 KB

    Here's my cheat (and cheap?) way If you want to get fancy and center the numeric and boolean indicators, you could add spacers on the north and west sides, too.
    Attachments:
    ClusterSpacer.vi ‏13 KB

  • How can I display all results of a array element in a TS2.0 NumericArrayMeasurement in a single report line?

    TestStand2.0 generates for each result property ( data, limits, status...) of each array element in a NumericArrayTest an extra line in the test report.
    How can I change this to display all result properties of one array element in a single line?
    How can I reduce the spaces between the property name and its value in the report?
    How can I delete the message: "Measurement[x]" and display only the Measurement Alias (named in the Edit Limits menu)?
    This means I like to change my report from:
    Measurement[0] (ADC1):
    Data: 5000
    Status: Passed
    Measurement[1] (AD
    C2):
    To:
    ADC1: Data: 5000 Status: Passed
    ADC2: ...

    Hi,
    What you can do, is use the Override Callbacks for Modify the Report that is Generated.
    Also you can also change the report sequence 'reportgen_txt.seq' to achieve the desired affect. If you go for modifying the report sequence then copy this to the User folder and then make your changes.
    In the Resources Library you can find simple examples were the report has been modified by either using the Override Callbacks or by modifying the actual sequence.
    One other item in the Report Options you will have to set the 'Select a Report Generator for Producing the Report Body' control to use the Sequence instead of the DLL.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • How can i change the order of  elements in a JList ?

    Hi,
    i would like to know if it is possible to change the order of elements in a JList ? Maybe i could use drag and drop to do this ?
    Thanks for answering.

    The simplest way is probably to implement ur own listmodel and then supply the listitems in the order u want. Example:
    class MyListModel
              extends AbstractListModel
              implements ContactListListener {
    public int getSize() {
    return listitemcount;
    public Object getElementAt(int index) {
    //here u return the item for the index at the list
    //if u for example have an array of strings
    //which u wanna have listed in reversed order (reversed to
    //the order in the array, u could do
         return myarray[getSize()-index];
    }

  • Read part of an array element

    Hello All.
    As indicated in the title, I am trying to read part of an array element.
    What I'm doing is reading values from a LeCroy scope using a "write" than "read" I have returned the read values into an array but the issue is the scope returns a value "1, 52.33E-3"
    I simply want the element to be 52.33 that way I can use that for other calculations.
    For example my array is.
    "1, 34.334E-3"
    "1, 53.343E-3"
    "1, 143.232E-"
    And I want it to be
    34.334
    53.343
    143.232
    Thanks!
    Solved!
    Go to Solution.

    Another option is to use Spreadsheet String to Array and use the comma as the delimiter.  It can actually change your string into an array of numbers.  Then you just index out the number you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Display a particular array element on the front panel

    Hello,
    I was wondering if it's possible to change which element of an array control is displayed on the front panel from within the program.
    Here's why I want to do it: I have an array of clusters, each of which contains a set of controls.  The controls in each cluster specify a bunch of different parameters for a few different instruments that are being controlled by Labview.  The user changes all the values on the front panel before the program starts, then the program steps through the array elements one by one.  I'd like to be able to change the array's display so that the user can know which set of parameters is active (and thus what is currently in force) while the program is going -- otherwise the element that is displayed is just wherever the user left it last.
    Thanks in advance for any help.

    See also: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=317419#M317419
    LabVIEW Champion . Do more with less code and in less time .

  • How to copy an array element in one class to an array in another class?

    Hi,
    I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
    Is it something like this:
    System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?

    drew22299 wrote:
    Hi,
    I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
    Is it something like this:
    System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?System.arrayCopy will overwrite whatever is already in the array. It is your job to make sure it copies into the proper array location.
    That being said, you're only moving a single student. This is not something you would use arrayCopy for, as you can just do that with simple assignment. Also, you should consider giving Class a method to add a student to its student list, as the class should know how many students it has and can easily "append" to the array.
    Note: I hope you noticed the quotes around append. Java's arrays are fixed size. Once allocated, their size cannot change. You may want to consider using one of the List implementations (ArrayList, for example) instead.

  • Type defined array of clusters for holding configuration data - setting default values for each array element

    Hi,
    I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.
    The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  
    I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?
    I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.
    To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.
    Solved!
    Go to Solution.
    Attachments:
    CM_AnalogInputs.ctl ‏11 KB

    Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for

  • Report Layout Variant - transaction S_AHR_61016503 - Staff Assignments

    Hi, One of our users has created a layout variant in the above report. Some other users can view and choose the layout but one cannot. Is there an authorisation object missing? If not, does anyone have any ideas why this one person cannot view it. Th

  • Can i connect my HDTV with ipad

    Can i connect my HDTV with ipad?

  • SPRY using .csv or .txt file

    Hello, I am interested in any ideas on the best way to get Spry working with a .csv or .txt file? We sometimes have the misfortune <vbg> of having to take others files (.csv or .txt file) and display them in a table format without converting them. I

  • How to get document from documentfragment

    hi, I tried the xsl Sample Code from Oracle XDK, The Output is a documentfragment. How can I build a domdocument out of that documentfragment? Sorry about the short description, but I think XML Gurus know what I mean ;-). Thanks Deltev

  • User dialog program

    hi experts, i am new to ABAP. can anyone help me with this? requirement: i created a ztable with 4 fields having some data in it. my requirement is: create a screen with 4 fields from ur ztable with SAVE and CANCEL as push buttons. if i enter some da