Can I write a subVI that accepts a generic-dimension array?

I'd like to write a subVI with an input that is an array. The thing is, sometimes the array will be 1D, sometimes 2D, sometimes more.
If I try to pass an array reference, the reference "knows" what dimension the array is.
If I pass the array directly then I'm hardwired to accept whatever kind of array I put in my subVI as the input.
Is there a way to pass an array reference that is NOT specifically dimensioned?
A related question: Is there a way to get the array's dimension from a property node? As far as I can tell the only way is the get the value property and then use Array Size. It seems like the array's dimension should be a property.

Hello again Bmarsh
> I'd like to write a subVI with an input that is an array. The thing
> is, sometimes the array will be 1D, sometimes 2D, sometimes more.
>
> If I try to pass an array reference, the reference "knows" what
> dimension the array is.
>
> If I pass the array directly then I'm hardwired to accept whatever
> kind of array I put in my subVI as the input.
>
> Is there a way to pass an array reference that is NOT specifically
> dimensioned?
When you create the array control refnum on the subVI, make sure it is not
strictly typed to an actual array. Create it from the palette (Control
Refnum)
and select Array class or otherwise unselect "Include Data Type" in the
right-click menu of the control refnum. Then the reference is generic to an
N dimensi
onal array.
>
> A related question: Is there a way to get the array's dimension from a
> property node? As far as I can tell the only way is the get the value
> property and then use Array Size. It seems like the array's dimension
> should be a property.
You can have it indirectly reading the "Index Values" property, which is an
array of indices (one per dimension) of the element displayed in the
top-left corner of the array indicator. the length of this 1D array is the
number of dimension of the referenced array.
Jean-Pierre Drolet
LabVIEW, C'est LabVIEW

Similar Messages

  • How can I create a subVI that has state?

    I'm trying to simplify a VI that I inherited and I noticed a recurring pattern that IMHO should be a subVI.  The pattern is that we have a digital output line that is controlled by a timer.  Each output has a start time for it to activate and a duration after which it is turned off.  When the state changes, a single line entry is added to a common log file and an indicator shared variable is set so that the remote host VI updates.  We have a big while loop that checks the current time against each of the activation conditions.  To detect when the state has changed, we're using a shift register (for each actuator).  It's one thing to see the same pattern 3 times, but it's worse -- we want to sometimes use a different number of actuators.  If I was writing this in C++ (with which I'm far more comfortable than LabView), I'd write a class for the actuator and instantiate it N times.  The class would have member data to keep track of its state.  I can create a subVI that does the meat of the design pattern, but I can't figure out how to store the previous state in the subVI without requiring it to be passed in.  How do I keep the state and behavior of a VI together?  Surely there's a way to do this because otherwise I can't see how you could implement state-ful algorithms like, say, a PID controller.  But I'm at a loss to figure it out ...
    Thanks.
    Keith.

    To save state in a subVI and not use that state in other subVI calls, make the subVI reentrant.  When a subVI that is reentrant is called it creates a unique memory space for that subVI.  This is called a clone.  That memory space is where state is held for that subVI.  Keep in mind that it also means that the memory footprint is going to be larger.
    To set a subVI to be reentrant, open it and go to File -> VI Properties and select execution.  It will be a choice on the bottom left.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • How can I write a program that compiles without warnings?

    I tried the following with the 1.5 beta-compiler (build 28; I think):
    class Y {
         public static final class Pair<X,Y> {
           private X fst;
           private Y snd;
           public Pair(X fst, Y snd) {this.fst=fst; this.snd=snd;}
           public X getFirst() { return fst; }
           public Y getSecond() { return snd; }
           public String toString() { return "("+fst+","+snd+")"; }
      public static void main(String... args) {
         Pair[] pairArr = new Pair[10];              // supposed to be an array of Pair<Integer,Integer>
         for (int i=0; i<pairArr.length; i++)
             pairArr[i] = new Pair<Integer,Integer>(i,i);
         for (int i=0; i<pairArr.length; i++) {
             Pair<Integer,Integer> p = pairArr; // unchecked warning
         System.out.println(p);
         Integer first = p.getFirst();
         Integer second = p.getSecond();
    // ... more stuff ...
    It turns out that I get an unchecked warning when I extract an element from the array of pairs. Okay, that's fine. How can I avoid the warning? I had expected that an explicit cast would help.
      Pair<Integer,Integer> p = (Pair<Integer,Integer> )pairArr;
    With a cast I'm telling the compiler: "I _know_ what I'm doing; please trust me." But the compiler still issues a warning.
    How can I write a warning-free program in this case? The only thing I can think of, is not using the parameterized type Pair in its parameterized form. But it's not the idea of Java Generics that I refrain from using parameterized types. What am I missing?

    It turns out that I get an unchecked warning when I
    extract an element from the array of pairs. Okay,
    that's fine. How can I avoid the warning? I had
    expected that an explicit cast would help.
    Pair<Integer,Integer> p = (Pair<Integer,Integer>
    )pairArr;
    With a cast I'm telling the compiler: "I _know_ what
    I'm doing; please trust me."  But the compiler still
    issues a warning.  Yes, but at least you were able to change the warning from "unchecked assignment" to "unchecked cast" which is a little shorter ;-)
    Seriously , since arrays of generic types are disallowed, there is probably no way to get rid of these warnings - which makes a strong point for eliminating "unchecked" warnings altogether (see the other thread "selectively suppressing compiler warnings")
    Cheerio,
    Gernot

  • Can I write a macro that will extract pages

    I'm pretty good at using Microsoft's VBA for writing macros in Excel.  I'm wondering if Acrobat has anything similar to manipulate pdf files.  My company has a lot of PDFs that we want to split up into small documents.  I'd like to be able to write a script that would look for certain text, then based the page where it found the text, it would extract a range of pages into a new document.  Think of it as taking a book and having the macro break it up into chapters so each chapter would be it's own PDF file.  Even better would be for the macro to do this to all files in a folder.  Is something like this possible in Acrobat?

    It's possible with JavaScript. JavaScript can be using in a batch sequence (aka Action), to deal with a collection of documents.
    Here are the basic methods you'd use:
    doc.extractpages: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.465.html
    doc.getNthPageWord: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.486.html
    doc.getPageNumWords: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.488.html

  • Taking an array of unsigned word an using it in a subVI that accepts an unsigned long

    I have a user specified sized array that is in unsigned word(16bit). I need to use a subVI, but the subVI only accepts unsigned long(32bit). I was wondering if anyone would know how to make this work.

    Hi Amy;
    Unless I am missing something, there should not be any problem inside LabVIEW.
    To play it safe and keep LabVIEW performance up, convert the array using the "To Unsigned Long Integer" vi located in the function palette:
    Numeric -> Conversion
    Regards;
    Enrique
    www.vartortech.com

  • How can I write a code that triggers when clicking on Save button

    I want to hide certain fields inside my tracking list, if the login user is not part of the “Managers” group.
    To do so I want to add the following Page-load code inside a web part :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    {SPGroup group = site.Groups["Managers"];
    bool isUser = site.IsCurrentUserMemberOfGroup(group.ID);
    if (isUser)
    {textbox.Visible=false;}}
    And the following custom code that triggers when saving the form :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists["ListName"];web.AllowUnsafeUpdates = true;
    SPListItem item = list.Items[SPContext.Current.ListItem.UniqueId];
    txtTitle.Text = item["Title"] as string;item.Update();web.AllowUnsafeUpdates = false;
    But I am not sure where exactly I should add the custom code for the save button ? I tried writing it inside the Oninit method , but I got many errors as shown below:-
    So can anyone advice how i should write the web part to include the Page load & the custom save button code?
    second question in general is my above approach considered valid , i mean to hide/show list columns using web parts ?

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Can Anyone Write a Program that does this?

    Once again , I know it's simple but I unfortunatly can't accomplish this task if anyone can write this program for me with the use of simple recursive arguements I would appreciate it..
    pre: n greater than or equal to 0
    post: return true if n is prime and false otherwise
    thats the problem

    I scrapped working on that one , heres what im doing now..public class plus251
    We are to Recursively add well you can read the pre and post conditions, now im basically supposed to follow this same setup which I wrote out , but now im too multiply by adding and I cant figure out the recursive part I know that the base case is if a == 1 return b , but its the else which I have no clue how to write..
    public static void main(String[]args)
         /* pre: a and b are positive integers
         post: outputs a + b by adding 1 to b, a times
         int a, b;
         System.out.println("enter an integer");
    a = Console.readInt();
    System.out.println("enter an integer");
    b = Console.readInt();
         System.out.println("a+b = "+ plus(a,b));
    public static int plus(int a, int b)
         /* pre: a and b are positive ints
         post: returns a + b
         if (a==0)
         return(b); /* this will add the accumulated
    ones to b to get the total */
         else
         return(1+plus(a-1, b)); /*this returns 1 until a
    becomes 0 */
         a is 0 ---- return b
         plus(b, k) ---- returns mathplus(b, k)
         plus(b, k+1) --- returns mathplus(b, k+1)
    plus(b,k+1) ---- returns 1+ plus(b, k)
    |
         |          1+ mathplus(b, k)
    |
         ------------------ mathplus(b, k+1)

  • How can I write this small function to create number of Array(s), please?

    Guys,
    How can I have a function create Array depending upon the passed argument. Am I doing this right?
    function createArray(n:int):Array
        for(var i:int=0; i<n; i++)
           var nArr = new Array();
           return nArr[i];
    Thanks a lot.

    var aArraySet:Array = createArraySets(5); //create 5 arrays
    // Array 1 -> aArraySet[0]
    // Array 2 -> aArraySet[1]
    // Array 3 -> aArraySet[2]
    // Array 4 -> aArraySet[3]
    // Array 5 -> aArraySet[4]
    function createArraySets(n:uint):Array
        var aArraySet:Array = new Array();
        for(var i:uint=0; i<n; i++)
           aArraySet.push(new Array());
        return aArraySet;

  • How to create a projector that accepts a file that is dragged on its icon?

    I would like to develop an application that allows it to receive as input any file that is dragged on the icon of the projector.
    In practice: I would like to know the (path of) file dragged on it, so that then the application can work on it.
    Do you know how to do?
    Thank You.

    Update:
    It is possible to do it with
         http://www.eee-craft.com/director/awaOSUtil/
    BUT Director can't produce a Projector that accepts the dragged file.
    Any ideas?
    Thanks!

  • How can I insert a required subVI that is required but Labview won't accept it?

    I am trying to use a VI named Termperature Monitor that was provided in
    the Labview 7  library included on the CD but it seems to be
    missing subVIs. I located the subVIs on the cd and attempted to insert
    them into the block diagram where the question marks are. Despite the
    fact that the names of the subVIs match what Labview expects, the app
    won't accept them. Is there a way to force them to accept the subVI
    that I picked?

    Have you installed LabVIEW? and if yes, aren't the example vi's on your harddrive now? How are you "attempting to insert them"? When LabVIEW starts loading a vi and hits a sub-vi that it can't find it will eventually pop up a message with a file search box. If you then navigate to where the vi (with exactly the same name ) resides it should then use that vi. If it, for whatever reason, doesn't match (different connections in particular instance), it should still place it on the diagram, but with broken wires. Alternately you can right click on the blank icon with ?, scoll down to "replace" and navigate to the correct one. This way doesn't require the new vi to have the same name. I'm not sure what happens if the vi you are looking for is on a CD though.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Firefox doesn't accept some sites and IT'S FREEZING sometimes and you can't write anything or click anywhere...reaaly disaponting, I have to restart it and after a while same thing, I can't close any tab only by options close tab.

    Firefox doesn't accept some sites and IT'S FREEZING sometimes and you can't write anything or click anywhere...reaaly disaponting, I have to restart it and after a while same thing, I can't close any tab only by options close tab so you can't use Command Q or Command R for reloading...GRRRRRrrrr, hate this

    As I asked previously are you able to have tabs open as a window by using the right clicking option ?
    When you close Firefox you should use
    *'''Firefox button -> File -> Exit '''
    Are you doing that ?
    I suspect what may be happening is Firefox is hanging as it closes down.
    * see [[Firefox hangs or is not responding - How to fix#w_firefox-hangs-when-you-quit-it]]_firefox-hangs-when-you-quit-it
    * this explains how to check & if necessary kill the process [["Firefox is already running but is not responding" error message - How to fix it#w_end-firefox-processes]]_end-firefox-processes
    A related possible problem is that you may have built up many copies of the restore files. These are stored in the Firefox profile. The easiest method of finding the profile location istouse
    *use '''Firefox button -> Help -> Troubleshooting Information <br /> -> [Show Folder]'''
    *see [[Profiles - Where Firefox stores your bookmarks, passwords and other user data]]
    You need to look for the files ''sessionstore.js'' and numbered duplicates of that. Delete them.
    * see http://kb.mozillazine.org/Firefox_hangs#Multiple_sessionstore.js_files

  • Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library.

    Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library. I can restore the artwork (and make my apple tv see the movie exists as well) by going into the movie library and clicking on each movie by hand, slecting get info, and then selecting enter. Now doing this 10 times in 20 days was fun and all BUT I would really like to automate the process so everytime itunes screws it up I can fix it easier.
    I saw this example of an itunes script that restores artwork for music
    tell application "iTunes" set theSelection to selection repeat with i from 1 to count of theSelection tell (item i of theSelection) set artworkCount to count of artwork repeat artworkCount times set theArtwork to data of artwork 1 delete artwork 1 set data of artwork artworkCount to theArtwork end repeat end tell end repeat end tell
    but I need to tweak this to fit my needs for simply clicking the "get info" button and "enter" in the movie library rather than all the stuff this guy has listed. Any ideas or help on writing this? Thanks.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Can I read/write global variables that are in other PC?

    I attach the vis and the executables.
    My problem is that when I run( continuosly, because in other way, I read the default value of the variable) getvalue.vi and setvalue.vi, I don´t have any problem, I can read/write the global variables, the two vis is running in the same PC.
    But when I do the exe and I run them continuosly , it doesn´t work.
    Any solution?
    Thanks in advanced!
    Graci
    Attachments:
    Get_Value.vi ‏30 KB
    Set_Value.vi ‏30 KB
    Exe.zip ‏272 KB

    Hello Bichillo,
    By running the vis continuously you are running into race conditions. If you cannot control when you are writing to or reading from a global variable, you cannot know whether the value writen/read is the right one or not.
    In your case the global variable value that is read is sometimes the last value writen and sometimes an empty string.
    To make the global variable behave as desired, that is, keeping its last value, the global variable must be in memory when you access it using VI Server. If it is not in memory, the returned value is an empty string. That´s why you sometimes get a non-empty string: when you access the global variable to read its value, it happens to be in memory because you´ve just writen to it.
    To ensure that the global
    variable is always in memory and it keeps its last value, you must include the global variable into your block diagram. I am attaching modified vis that implement this.
    Hope it helps.
    César Verdejo
    Training and Certification | National Instruments
    Attachments:
    Get-_Set_Value.llb ‏48 KB

  • HT201338 adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

    I have my Apple cinema display connected to my MacBook Air via the Thunderbolt port, but I also want to connect an ethernet cable.
    Is there an adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

    I have my Apple cinema display connected to my MacBook Air via the Thunderbolt port, but I also want to connect an ethernet cable.
    Is there an adaptor that accepts both VGA and ethernet cables at the same time that can be plugged into the Thunderbolt port

  • Where can I find a list of acceptable products that could have been used to apply to a Creative Suites Design Standard 4 Upsell?

    Where can I find a list of acceptable products that could have been used to apply to a Creative Suites Design Standard 4 Upsell?

    Upsells are completely independent of any specific requirements, which is the whole point.
    Mylenium

Maybe you are looking for

  • List of pending bills required from system

    Hi I have 58 branches all over India. Electricity Charges for all these branches are paid by HO depending on the electricity bill received by HO from branch. Electricity amount will differ every month for every branch Now at the month end, i need to

  • DAT files i e-mails

    Hi. When I receive a Mail with wordfiles, excel files or PDF files, they sometimes show up as a DAT file which I can not open. Is the problem in the computer of the one senind the file or is it in my iPad? If it is in my iPad, how can I correct it or

  • Keyboard won't re-pair with Mac Pro

    OK, here it goes... I have a 2007 Mac Pro (2 x 3 GHz Dual-Core Intel Xeon, 4 GB 667 MHz DDR2 FB-DIMM, 500GB HD) running OS X 10.6.8, with zero hardware issues this entire time. With it, I have the A1016 wireless keyboard. Never had issues with it eit

  • Install Aperture 2 Academic over Aperture 1.5.6 Academic

    Technically I suppose the software does not view this as an upgrade as the Academic versions have no upgrade path. What must I do to make the switch from 1.5.6 to 2 and retain the library links? Thank you.

  • Removing Application data - languages

    Hi all,  am I likely to make any problems for myself by uninstalling foreign languages from my 8900? When clicking on Applications via the DTM, loads of languages are presented that I just don't need.   Can I go ahead & uncheck them? Many thanks in a