How to use a vector of Boolean indexing a table

I have a table A = [1 2 3 4 5 6 7 8 9 10].

I also have an array of Boolean B = [1 1 0 0 0 0 0 0 0 1].

I want to use the table of Boolean B spot the items, create a new matrix C = [1-2-10]. In MATLAB, I would just type C = a.b.

I'm scratching my head trying to figure how to do this. A solution would be to go through a loop for, query b.i and remove a (i) If b = 1. But that would change the size of A, while the second time I did it, my rating would be a mistake.

Anyone know of a way to do it?

BONUS: If I have an AA 2D, with multiple columns, it would be nice to use B to select several columns of AA (in MATLAB, it would be CC = AA(:,B).

This can be done with automatic indexing with conditional tunnels.  The same approach could easily be applied to a 2D array, thus:

Tags: NI Software

Similar Questions

  • Recovery of the records by using the Ref Cursor or indexes per Table (which is better)

    Hi all

    I am interested to know if there is a performance (or other) advantages to return a result set from an Oracle stored procedure for a client application (for example, in Java) by using a Ref Cursor or Index by Table, respectively. Most of the people I met who know Java seem to use a Ref Cursor but did not say why this method is preferable. I'm not too familiar with Java and do not have the opportunity to test the difference between either method, but I am very interested in the other user forum about this view, gauging

    Kind regards

    Kevin.

    KevinFitz wrote:
    Hi zerathul,

    Thanks for the quick and helpful response. A REF CURSOR would be the best solution if the same set of results (content and number of records returned) should be dealt with by the application of the 'customer '. I'm guessing that maybe in this situation 'theoretical' that there might be less network traffic to return the set of results through an associative array,

    Kind regards

    Kevin.

    Yes, it would always be the best solution, because an associative array would mean collecting all the data in memory of expensive PGA on the database server before they pass any return on the network, while a fair Ref cursor is to feed the data over the network (maybe a little extra load, but you were unlikely to notice). Also the client application would treat a ref as of rows returned cursor data recovery and could treat them upon their arrival, an associative array is a collection of data which will then be entirely spent before any treatment could be done and then the treatment should go through the entire table to do.

    REF CURSOR will also provide other information such as the error codes etc regarding SQL if necessary. If you get an error when filling a table on the side of the database, it is not so easy to recover this error to the client.

    REF CURSOR is designed for this purpose. Use them.

  • How to use the transition of Boolean as trigger 0to1 = > 1impulse 1to0 = pulse > 0

    Hello!

    I have a HVenable Boolean button that will be used to toggle the output high voltage to a voltage source.

    The problem:

    I only need set to True to send the command Open HV

    and a value of False to send the command Close HV; the Boolean button sends a continuous real values train when it is on and a continuous values f when train off the power.

    How can I convert a transition from off to on / F t into one 1 pulse or pulse T

    and the transition between on and off / T and F in a single 0 pulse or pulse T.

    What instrument converts a transition of T F in a 1 or pulse T

    and a transition between T and F in a pulse of 0 (different from the first species of transition)?

    In the vi test, such an instrument would be inserted between HVenable button and select;

    If true, it will send an open command to visa O 01 CR

    If set to False, it sends a command to close O 00 CR.

    First of all, do not use continuous operate to make the code run more than once! Place the repetitive code inside a loop. Continuous run is a troubleshooting tool that you want to use (in moderation) during development.

    The key to your problem is to use the structure of the event. An event to change the value on the Boolean value HVenable will do exactly what you want.

    You don't need to Type Cast and all conversions. The value of the string constants '-' Codes display mode and enter the data you want.

    Lynn

  • How to use the Valueset array in an another Table Valuset

    Hi friends,

    I have a requirement let me explain the scenario.


    in a segment of the deposited Keyflex, I need to get all the notes of the company. that i made using the valueset table.

    now in another segment of the kff, I need to get all the steps of the year according to the selected category.

    like if I ranks say G1, G2, G3, G4...
    and no rank
    for G1-steps (1,2,3,4,5,6)
    for G2-steps (1,2,3,4)
    for G3-steps (1,2,3)
    for G4-(1,2,)
    etc.
    My requirement is now if the user select the grade G1 of the valueset. then in another filed of the segment would come only those steps that are valid for this rank.

    I hope that I have given clear pic of my requirement can someone please help me, how to do this.


    Thanks in advance.

    Hello

    I think that the requiremnt can be achieved by building the master as independent Valueset (for example: Grades) and child as a dependent (eg Valueset; Gradestep).

    condition is possible in my opinion. give it a try in the dev instance.

    See you soon
    M.

  • How to use the search bar 'Find' in the table of contents to find the script FULL of my course?

    Hello

    My project contains voice narration with the support of chips. Start-up option "find" in the table of contents looks only bullets of text on each slide to specific words. Is there a place I can insert the full script (rather than the abbreviated chips) spoken by the narrator in my class so that the option "find" search in these words?

    Thank you!

    Hello!

    Captivate, in fact the finding of OCD to retrieve and search for the text content of slide and slide labels usage.

    What you can do to get your full script to work.

    (1) add a text caption slide.

    (2) paste is your complete script. (From slide notes)

    3) go to properties of legend text-[disable] option which does not show in the output.

    In this way, you would have all your content on the slide to search for in the table of contents, but still not visbile to users, they would continue to see the short balls.

    I hope this helps.

    Thank you!

    Anjaneai

  • kindly tell how to use the unique value of a table with the index 0

    kindly tell how to use the unique value of a table with the index 0

    Hi
     
    Yep, use Index Array as Gerd says. Also, using the context help ( + h) and looking through the array palette will help you get an understanding of what each VI does.
     
    This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
     
    -CC
  • How to use a form created on the Capture of a vector

    People, I'm having difficulties to find out how to use a form created on the Capture of a vector. For example, I open Illustrator on my desk and, although the form is saved in a creative library of clouds, I can't find how to open this archive as a vector. I tried everything from capture, but then I can just export the shape as a bitmap image. I'm really lost on this.

    Hello Cristina,

    In Illustrator, simply drag the shape of your library panel in an open document. That's all there is to it.

    Mike

  • How to use layers and colors of the index to even

    I work a lot in pixel art. I use indexed images. I need to be able to work in layers while working with indexed colors.

    How to use the index while working with layers?

    You can't do it in Photoshop.

  • How to import a vector editable in Illustrator to draw I was working with on my portable version of Illustrator? (I'm trying to leave my laptop at home and use my iPad to show customers the work and edit them in place with them.)

    How to import a vector editable in Illustrator to draw I was working with on my portable version of Illustrator? (I'm trying to leave my laptop at home and use my iPad to show customers the work and edit them in place with them.)

    Hi,

    This workflow is not yet possible to the draw. But it has been a very popular feature request lately and I know that the team is studying how it could be integrated into the app.

    I will definitely pass your comments along to the team.

    Sue.

  • How can I use a vector image to stretch with the background in Muse master pages?

    How can I use a vector image to stretch with the background in Muse master pages?

    Click on the 'Fill' text not the drop-down arrow.

  • How to select cases or an event using an array of Boolean 2D.

    Hello world

    I'm trying to use an array of Boolean 2D to select different events or case. For example, if the variable Boolean 1 and 2 are TRUE, case 1 will be selected. If the Boolean variable 1 is FALSE and 2 is true, case 2 will be selected and so on. I tried to use the Boolean to the number, but I need a way to differentiate between B1 = B2 = FALSE and B1 = B2 = TRUE, FALSE, TRUE. In other words, no two Boolean combinations can lead to the same case, seminar.

    ~ Mario

    You need to remodel your table 2D to 1 d first.

    Now, assuming that you have the items in table 64 less thant, "boolean array to the number" will give you a unique number for each possible combination of bit.

    M_Mario_M wrote:

    I tried to use the Boolean to the number, but I need a way to differentiate between B1 = B2 = FALSE and B1 = B2 = TRUE, FALSE, TRUE.

    As mentioned, each combination will give you a different value. You must simply ensure that you Add unique cases for each number. Add as many cases you want to structure your business. If you do not, several models of trigger default case-sensitive.

    If your problems persist, please contact your code.

  • Boolean index in the array

    In Matlab, often use a Boolean array to access the specific values in a table.

    It is a good way to reduce the itterative loops and improve the speed of the code.

    I'm trying to find a way to do this in a Mathscript node, otherwise the code takes forever to run.

    Common code in Matlab and Mathscript:

    a = [1,2,3,4,5]; % This is normally a much larger range

    b = [1,0,1,0,1]; %I whether Boolean, but by default it's double

    c = b > 0;  b change % to boolean

    d = [9,9,9,9,9];

    The Matlab code is:

    d (c) = a (c);

    d

    > d = [1 9 3 9 5]

    If I run the above in Mathscript, I get the following error:

    In Mathscript, to achieve the same result "d" I currently have this:

    for i = 1:length (d)

    If c (i) == 1

    d (i) = a (i);

    end

    end

    d

    > d = [1 9 3 9 5]

    A slightly faster version is:

    for i = 1:length (d)

    j = 1;

    If c (i) == 1

    e (j) = c (i);

    j = j + 1;

    end

    end

    d (e) = (e);

    d

    > d = [1 9 3 9 5]

    Any ideas?

    Thank you

    Hello

    The code you have posted works fine in the MathScript in LabVIEW 2009 node as well as in the MathScript window and the MathScript node in LabVIEW 8.6.  As such, I'll assume that you have found an error in the window of MathScript in LabVIEW 2009.  We have already identified this problem and currently filed the bug report 151999 for her.  You see error message did not come through in your post, so I guess it is-90026: ' indexes for an indexing operation matrix must be real and positive integers. "  The problem is that we do not treat the indexing variable 'c' as a boolean type.  As a result, it reports an error when it tries to use the index 0 instead of a fake.  We are working on a fix for a future version.

    To work around the problem in the MathScript window, you can use find instead of any Boolean indexing command.  It should integrate more quickly than the implementation of loop that reference you.  Instead of
    d (c) = AC;
    use
    d (Find (c)) = a (find (c));

    Grant M.
    Staff software engineer | LabVIEW MathScript | National Instruments

  • How to index a table on multiple sites?

    Hello

    How to index a table on multiple sites?

    I searched this issue and was not able to find the answer. I understand that it can be done with loops, but I don't know how.

    I use the detector of crete vi for frequency domain data collected a VNA (s2p) file. The products contain a table of amplitudes and a table of locations. The problem is that the locations refer to the index of table of amplitude, which is not the same as the frequency. My idea is that I can use this output of the places table to index the frequency to the detected peak frequencies table and then draw these, as well as some analysis data and manipulation on them. Currently, I can do this only by consulting table on the front panel.

    The entrance to the peak detector is currently a table 1 d of the scale (what is the problem?).

    I also looked at the supply frequency & estimate VI, but this VI seems only exit of scalar data for the largest peak, not exactly what I'm looking for.

    Thanks for your help.

    You have a second table for the tested frequency?  If so, then you are right that you just need to index this table with the indexes by the Ridge detector.  Use a loop for.  Automatic index to the index, use index in array to get the value of the frequency and autoindex on frequencies.

  • How to use camera integrated in my inspiron 518 desktop?

    I don't have an instruction book with my inspiron 518 desktop computer.  It has a camera built into the top of it, but I have no idea how to use.  Would like to know - how...

    I don't have an instruction book with my inspiron 518 desktop computer.  It has a camera built into the top of it, but I have no idea how to use.  Would like to know - how...

    =========================================
    You can download the manuals for your inspiron 518 desktop...
    (I have not found webcam mentioned in 518 docs)

    Dell Inspiron 518/519 manual
    http://support.Dell.com/support/eDOCS/systems/insp518/en/index.htm

    The following Dell Document provides instructions for a WebCam...
    the same instructions apply to your computer.

    Dell XPS M1530
    http://support.Dell.com/support/eDOCS/systems/xpsm1530/en/OM/PDF/RU335A02MR.PDF
    (Webcam info starts on page 69)

    Good luck... John Inzer - MS - MVP - digital media experience

  • How to use KEY_ENTER to simulate a NAVIGATION_CLICK?

    I want to use KEY_ENTER to simulate a NAVIGATION_CLICK, i.e. when I press the key of the keyboard, I want the application acts as I click on the trackwee. I use the code below:

    // Overrides: keyChar(...) in Screen
    
    protected boolean keyChar(char key, int status, int time) {
        switch (key) {
            case Keypad.KEY_ENTER:
                NavigationEvent clickEvent = new NavigationEvent(NavigationEvent.NAVIGATION_CLICK, 0, 0, KeypadListener.STATUS_TRACKWHEEL);
                clickEvent.post();
                return true;
        }
        return super.keyChar(key, status, time);
    }
    

    In the screen, there is an ObjectListField which "replaces: navigationClick (...)» in the field' and a ButtonField (saveButton), I add a changeListener to the button using:

    saveButton.setChangeListener (saveListener);

    and the button is built using "ButtonField.CONSUME_CLICK".

    The problem is:

    (1) when I press the Enter key on the ObjectListField the ListField is like I click on the wheel, but a "fast MEMU" appears, as you click on the empty area of the screen.

    (2) when I press the Enter key on the button, nothing happens.

    (3) when I click directly on the wheel, every thing is fine.

    How to use KEY_ENTER to simulate a NAVIGATION_CLICK?

    I solved this problem in this way:

    Override keyChar method in the class of the screen:

    protected boolean keyChar(char c, int status, int time) {
        switch (c) {
            case Keypad.KEY_ENTER:
                // check if we need to treat it as a click event.
                boolean consumed = super.keyChar(c, status, time);
                if (consumed == false) {
                    navigationClick(status, time);
                }
                return true;
        }
        return super.keyChar(c, status, time);
    }
    

    In major events, Director of the screen first catch the event and dispatches the event to the fields inside. I don't really know why invoke the navigationClick() method cannot create the button directly act as we click on the button (if anyone knows please tell me), but the code above can act as I had hoped.

Maybe you are looking for

  • Second SATA hard drive not detected by Bios and Device Manager

    Original title: second SATA hard drive Hard drive not detected by the Bios and the device under Vista Home Premiun Manager

  • OfficeJet 6110 Windows 8.1 compatibility

    After upgrading my ro PC Windows 8.1 Overview Pro, print my 6110 OffcieJet function has stopped working. Is there a new driver for Windows 8.1?

  • HP Pavilion DV5-1215TX drivers audio Windows 8

    I upgraded my laptop dv5 with windows 8, but I can't use the application of driver IDT high definition... I tried to install the application from the driver win 7, but after the installation there was no noise... so I restored to 8 default windows dr

  • Application works only with the WAP. good with wifi

    My application works fine with wifi connection, but does not not with WAP GPRS. + 2 days devoted to this subject, but no success. Here's the code... Hi mantaker, yet I don't have the solution to my previous problem. my application using httpconnectio

  • sl_def_acl?

    Hi all, Anyone know what is this list of access (sl_def_acl)? I found what makes a 'sh access-list' command on a Cisco 837 router (Version of IOS 12.3 (4)). It seems to be taken into account if applied to the command of the inspection. There is a way