From one array to another

Hi,
I have an array which produces random numbers and pass this list to another array. How can I select the numbers  from the first array, so that only 1 every let's say 5 goes to the second array? Thanks,
P.S Here attached is the VI
Attachments:
Random Array generator1.vi ‏21 KB

The simplest way is to use Decimate 1D Array. You can expand this node so that it creates 5 output arrays. The first output will be every 5th element of the input array, starting with the first.
Message Edited by Marc A on 10-11-2007 09:02 AM
Attachments:
Example_BD.png ‏6 KB

Similar Messages

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

  • Assign values from one array to another

    Hi, I am trying to solve a problem that asks that I assign values in the array that is input, which meet a certain criteria, into another array. isFunny will determine if a given integer is funny, countFunnies will determine how many integers in the given array are funny or not. collectFunnies should assign elements from the first array that are funny into the new array. Please take a look at the code, I am at a loss, everything looks good to me.
    public class BatchOne
    public boolean isFunny(int x) {
    if (x%2 == 0) {return true;}
    else {return false;}
    public int countFunnies(int[] a) {
    int count = 0;
    for (int funCheck :a) {
    if(isFunny(funCheck)) {
    count++;
    return count;
    public int[] collectFunnies(int[] a) {
    int count = 0;
    int i = 0;
    for (int funCheck :a) {
    if(isFunny(funCheck)) {
    count++;
    int[] array = new int[count];
    for (int funCheck : a) {
    if(isFunny(funCheck)) {
    array[i] = funCheck;
    i++;
    return array;
    Thanks,
    T

    Ok, I am new to programming and posting so likely need some refinement to my posts.
    I am using BlueJ to write my code, the above posted is my entire code. It is compiling correctly but when I run, the return was giving me back something strange, I am not sure if I can post a screenshot because it would be hard to explain.
    However, upon further review, it seems that there are some intricacies with BlueJ that I am obviously not used to, because when I select to inspect the return, the program seems to be returning an array of values that is in line with my intended goal.
    Thank you for your guidance in terms of how to use the forums.
    T

  • Apply selections from one array to another?

    I've got a List box. It's dataProvider is an Array, myArray1.
    The user makes selections (it's set for multi). I can get these via
    selectedItems or selectedindices. No problem. Let's say I store the
    selectedIndices in another array, "mySelections".
    No where's where I'm hung up: I have another array
    (myArray2). I need to select the items in this array that have the
    same indices as mySelections.
    For example, if the myArray = ["headgear", "outerwear",
    "footwear", "trousers", "shirts"]
    and the user selects 0,2,3
    And myArray2 = [ "cap", "parka", "boots", "jeans", "tanktop"]
    I want another array or string that includes 0,2,3 of
    myArray2, or "cap, boots, jeans"
    How would I do this? Thanks.

    Have you tried simply assigning the mySelections array to the
    selectedIndices of the second list?
    Tracy

  • How can I migrate file shares & permissions from one volume to another on the same server?

    I am replacing a storage array and as part of that process, I need to move files/folders and Shares/permissions from one Volume to another volume within the same server.
    The server is Windows 2003 file server.  The file transfers are not a problem, moving all 40 shares with permissions etc. is my main concern because in order to maintain everything I need to change the drive letter of the new volume to match the old
    one so that links to various resources throughout the network do not break.

    Hi, 
    If you want to copy files/folders from one Volume to another volume within the same server, you could use the File Server Migration Tool (FSMT) or Robocopy to accomplish your goals. The tool can move all of the files from the shares on your original volume
    to the new volume.
    For more detailed information, you could refer to the articles below:
    File Server Migration Toolkit
    http://technet.microsoft.com/en-us/magazine/2006.10.utilityspotlight.aspx
    The File Server Migration Toolkit (FSMT) is a free download available at:
    http://www.microsoft.com/en-us/download/details.aspx?DisplayLang=en&id=10268
    Robocopy
    http://technet.microsoft.com/en-us/library/cc733145.aspx
    FSMT and Robocopy will not copy Share permissions but only NTFS permissions. So if the drive letter will not be changed, you can backup and restore the Share permission with steps here:
    Saving and restoring existing Windows shares
    http://support.microsoft.com/kb/125996
    Regards, 
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to move entry from one container to another

    Hi!
    We are using DBMS_LDAP package to attempt to move an entry from an LDAP container to another container. We have tried modrdn2_s (takes a session, the old dn, the new dn, and a PLS_INTEGER indicating whether or not to delete the old entry; or at least this is our interpretation of what the function does).
    Attempting to move an entry with this function gives the following error(s):
    ORA-31202:DBMS_LDAP:LDAP client/server error: Constraint violation.
    00002081:AtrErr: DSID--031D0809, #1:
    0: 00002081: DSID-031D0809, problem 1005 (CONSTRAINT_ATT_TYPE), data 0,
    Att d(description)
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.DBMS_LDAP", line 1455
    ORA-06512: at "SYS.DBMS_LDAP", line 929
    ORA-06512: at "OURSCHEMA.OURPKG", line 606
    ORA-06512: at "OURSCHEMA.OURPKG", line 88
    ORA-06512: at line 45
    I can't look at the SYS.DBMS_LDAP code since that is encrypted.
    I am currently researching ORA-31202 and talking with my LDAP/AD administrator. However I'm still wondering if this is the function that I should use for this. Does anyone know of any examples for what I'm attempting to do?
    Marc

    I spoke to my Active Directory administrator, and he suggested that I try to pass a new DN as an attribute in the modifications array passed to the DBMS_LDAP.modify_s function:
    --- Start of Code Sample ---
    -- create the modifications array
    v_mod_array := DBMS_LDAP.create_mod_array(n);
    -- set other attributes here
    -- set the new distinguished name here
    vl_mod_values(i) := v_new_dn;
    DBMS_LDAP.populate_mod_array(l_mod_array, DBMS_LDAP.MOD_ADD, 'distinguishedName', l_mod_values);
    -- then call the modify function (the modifications array has all the other attributes plus the new dn)
    DBMS_LDAP.modify_s(session, dn, v_mod_array);
    --- End of Code Sample ---
    The above fails too with an ORA-31202 error (which my AD administrator has not solved yet). Still my question is if my approach to moving my entry from one container to another is correct, or if I should be trying some other method. BTW, the directory structure looks like this:
    +<Domain>
    +--<DC=myorg,DC=test>
    ----+--<OU=Team>
    --------+--<OU=Headquarters>
    --------+--<OU=Terminated>
    etc, etc.
    I want to move the entry from the OU=Headquarters container to the OU=Terminated container.
    Any help is dearly welcomed!
    Marc

  • How do i Drag and drop From one tree to another and vise versa?

    I have two tree structures and i'm trying to drag a leaf of a branch from one tree to another and vise versa. i'm using flex 3 to code it. I'm also trying to put a prevention on dropping a leaf of one tree from being dropped inside a branch of another tree. Anything that is dragged over to another tree should be placed as a dangling node in that tree. Please share this code and help me find a solution.
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="
    http://www.adobe.com/2006/mxml" xmlns:comp="
    com.adobe.flex.extras.controls.*" initialize="data2
    new
    ArrayCollection(countries);"layout="
    absolute"verticalAlign="
    middle" backgroundColor="white" height="
    551">
    <mx:Script>
    <![CDATA[
    importmx.events.FlexEvent; 
    importmx.collections.ArrayCollection; 
    importmx.controls.Alert; 
    importmx.events.DragEvent; 
    importmx.managers.DragManager;  
    importmx.core.DragSource;  
    importmx.core.UIComponent;  
    importmx.controls.Tree;  
    // data provider for role name[
    Bindable] private vardata2: ArrayCollection; 
    // variable to store the node that is dragged from a tree 
    private var draggedItemOfAccessTree:XML = null;  
    private var draggedItemOfExclusionTree:XML = null; 
    private var dragItemAccess:DisplayObject =null; 
    private var dragItemExclusion:DisplayObject =null; 
    // Array to store the Role list[
    Bindable]public varcountries: Array = [{id: 0, name:
    "Role 1"},{id: 1, name:
    "Role 2"},{id: 2, name:
    "Role 3"},{id: 3, name:
    "Role 4"},{id: 4, name:
    "Role 5"},{id: 5, name:
    "Role 6"},{id: 6, name:
    "Role 7"},{id: 7, name:
    "Role 8"},{id: 8, name:
    "Role 9"},{id: 9, name:
    "Role 10"},{id: 10,name:
    "Role 11"} 
    // this event is called when we begin dragging a node in a tree 
    private function onAccessListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards1:DragSource = event.dragSource;  
    var items1:Array = ds1.dataForFormat("treeItems") asArray; 
    if (items1 != null && items1.length > 0 && (items1[0] isXML)){
    draggedItemOfAccessTree = items1[0];
    dragItemAccess = items1[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onExclusionListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards2:DragSource = event.dragSource;  
    var items2:Array = ds2.dataForFormat("treeItems") asArray; 
    if (items2 != null && items2.length > 0 && (items2[0] isXML)){
    draggedItemOfExclusionTree = items2[0];
    dragItemExclusion =items2[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onAccessListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = AccessTree.selectedIndex; 
    varvar2:Number = ExclusionTree.calculateDropIndex(event);  
    var node1:XML = AccessTree.selectedItem asXML;  
    var node2:XML = ExclusionTree.calculateDropIndex(event) asXML;  
    //restrict drag & drop to nodes within same parent  
    if(draggedItemOfAccessTree.parent() == node1.parent() || draggedItemOfAccessTree.parent() != node1.parent()){
    DragManager.showFeedback(DragManager.NONE);
    //return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onExclusionListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = ExclusionTree.selectedIndex;  
    varvar2:Number = AccessTree.calculateDropIndex(event); 
    var node1:XML = AccessTree.calculateDropIndex(event) asXML;  
    var node2:XML = ExclusionTree.selectedItem asXML;  
    //restrict drag & drop to nodes within same parent  
    if( draggedItemOfExclusionTree.parent() == node2.parent() || draggedItemOfExclusionTree.parent() != node2.parent()){
    DragManager.showFeedback(DragManager.NONE);
    // return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onAccessListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varSindex:Number = AccessTree.selectedIndex; 
    varEindex:Number= ExclusionTree.calculateDropIndex(event);  
    var Enode:XML = ExclusionTree.selectedItem asXML;  
    var Anode:XML = AccessTree.selectedItem asXML; 
    if((draggedItemOfAccessTree.parent() != Anode.parent()) ){
    AccessTree.removeChildAt(Sindex);
    ExclusionTree.addChildAt(dragItemAccess , Eindex);
    // AccessTree.rdataDescriptor.removeChildAt(Anode.parent(),draggedItemOfAccessTree,Sindex);  
    //ExclusionTree.dataDescriptor.addChildAt(Enode.parent(),draggedItemOfAccessTree,Eindex); }
    private function onExclusionListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varEindex:Number = ExclusionTree.selectedIndex; 
    varSindex:Number = AccessTree.calculateDropIndex(event);  
    var Anode:XML = AccessTree.selectedItem asXML;  
    var Enode:XML = ExclusionTree.selectedItem asXML; 
    if((draggedItemOfExclusionTree.parent() != Enode.parent()) ){
    ExclusionTree.removeChildAt(Eindex);
    AccessTree.addChildAt(dragItemExclusion, Sindex);
    // ExclusionTree.dataDescriptor.removeChildAt(Enode.parent(),draggedItemOfExclusionTree,Eind ex);  
    // AccessTree.dataDescriptor.addChildAt(Anode.parent(),draggedItemOfExclusionTree,Eindex); }
    private function onDragComplete( event:DragEvent ) : void

    Yes, I have set dragEnabled and dropEnabled to true. I trying to put restriction on dropping the node(aka leaf) of 1st free tree inside the branch(aka folder) of the 2nd tree. If something is dragged from tree1, it should be dropped only on tree2  i.e., dragged node should be appended at the end of tree2 and not inside nay of the branches of tree2. This functionality should work on both the trees. I'll be glad if u can provide the solution.

  • Copy variable from one thread to another

    My program requires user to input a java file which contains the run() method.
    In the input file, user can declare variables and use those variables inside the run method. User also need to enter the number of threads to be spawned.
    The problem is how can I construct some method like "copy" which can copy the variable from one thread to another in my program? I can't do that since I don't know the name of the variables that the user inputted.
    I've tried this:
    class helloworld extends thread{
    void run(){
    String a="hello";
    String b="world";
    copy(0,1,a,b)
    class myProgram {
    Class c = Class.forName(fileName);         // file name of user's file     
    Thread t[] = new Thread[p];             // p is number of threads
         for (int i=0; i<p; i++){             // create threads      
                   t[i] = (Thread) c.newInstance();  
                   t.start();
    public void copy(int sourThread, int destThread, String s1, String s2){
    t[sourThread].s1=t[destThread].s2
    But it doesn't work. It said "cannot resolve symbol s1 and s2".
    please help. urgent. Thanks a lot in advance.

    You need to seriously reconsider what you're allowing the user to do. The short answer to your problem is to use a shared, synchronized associative array.
    However, since the user can specify any number of threads, you will have to resolve deadlocks, and the fact that you're asking this question suggests you will have problems doing so until you have read up on threads and shared variables in more detail. (I don't mean to be dismissive. Deadlocks and shared variables have to be customized to the application, i.e., you have to figure out just when each thread will need access to the variable, what kind of access, and when.)
    In the meantime, take a step back and take a look at the big picture.
    From what you've said, I would guess a common example of your application is that I want to be able to read file "foo.dat", uppercase each letter in the file, and write it out to "fooXXX.dat" where XXX reflects the thread number. And specify any number of threads I want.
    Threads would not be the best way to accomplish this. Do this serially.
    Alternatively, I could interpret your problem as in you need to create a main() function that's capable of reading someone else's dot-class file, clone the object and start it. In which case, why do you want to share variables? If the user did his job correctly, then his file will already contain shared variables (or copy them as appropriate). All you have to do is clone the object via the new keyword, then call start() in it.
    You cannot share something when you don't know what you're sharing.
    The third option is that you're doing this as an academic exercise (i.e., homework). Granted, yes, your professor may ask you to do things illogically just to prove they can be done. Unfortunately, we're not supposed to help you in that case. People who read this forum generally try to find logical and efficient ways of doing things.

  • Copy Long raw from one table to another.

    Hi
    I am trying to copy data from one table to another. Source has one Long Raw column. There are about million rows in source table. And I am using Oracle 8.1.5. Whenever I execute the copy command, I get the following error message: Can someone help me?
    SQL> set long 64000000
    SQL> set copycommit 1
    SQL> set arraysize 100
    SQL> COPY to test/test@testfix CREATE resume_bkup1 using select * from resume;
    Array fetch/bind size is 100. (arraysize is 100)
    Will commit after every array bind. (copycommit is 1)
    Maximum long size is 64000000. (long is 64000000)
    ERROR:
    ORA-01084: invalid argument in OCI call
    SQL>
    Thanks
    V Prakash

    insert into emp_personal(emp_no, emp_pic) select emp_no, emp_pic from emp_personal_old where empno = '10059'
    Read the documentation as suggested by sol.beach.
    And fix your front-end to use supported datatypes.

  • Moving the files from one directory to another.

    It seems that this would be simple but I am not able to do it easily. I just want to move files from one directory to another directory. I tried the file class renameTo as in the following...
    File fFrom = new File("C:\\uhin\\batch\\outgoing");
    File fTo = new File("C:\\uhin\\batch\\outgoing\\back");
    fFrom.renameTo(fTo);
    but this doesn't seem to work. I have tried deleting the directory and then recreating it but this doesn't seem to work as in.
    fTo.delete();
    fTo.mkdir();
    any ideas ?
    thanks
    kris.

    That code you have there tries to rename the directory from C:\uhin\batch\outgoing to C:\uhin\batch\outgoing\back. I'm not sure if you can rename directories in general, but even if you can that particular renaming wouldn't work.
    However you didn't want to rename the directory in any case. You need to use a File method called listFiles (if I recall correctly... check the API documentation) which returns an array of File objects, representing all the files in that directory. Then loop through that array, and for each File in it, (1) create a new File object with the new name, and (2) call renameTo() to rename the file.

  • From one viewpoint to another via a third viewpoint

    Hi!
    I need help to make a function/script, on a button, that takes me from one viewpoint to another via a third viewpoint.
    I want it to be like this:
    When I push a button I want to change from view1 to view2 but before the camera goes to view2 it will go to view3, wait 1 second and then continue to view2.
    I have this function for changing views, which works fine:
    b var ViewExterior = function(viewname)
    b {var context3D = getAnnots3D(0)[0].context3D;
    b context3D.viewManager.goToView(viewname);}
    On the buttons I have:
    b ViewExterior = (view1); (or view2)
    I have tried with some delay function like:
    b function Delay(milliseconds)
    b {var date = new Date();
    b var curDate = null;
    b do { curDate = new Date();}
    b while(curDate-date < milliseconds);}
    and on the buttons:
    b ViewExterior = (view3);
    b callMy3DFunction = getAnnots3D(0)[0].context3D.Delay(1000);
    b ViewExterior = (view2); (or view1)
    What happens is that the program waits for 1 seconds, without going to view3, and then moves on to view2 (or view1).
    Any help on this would be helpful.
    With regards,
    Joachim Wilhelm

    Sorry about the delay.
    /Joachim
    //====================================================================
    //======== Begin - ViewManager.js
    //====================================================================
    // This class provides a method of saving camera views and smoothly
    // transition between them. It uses the CameraRotate class to provide
    // the camera motion
    // Daniel Beardsley, Adobe Systems, Inc.
    // March, 2006
    // Updated: 07/06/06
    console.println( "* The Javascript 'ViewManager.js' is now being read..." );
    function ViewManagerObject(cameraRotateObject)
    var Me = this;
    // Internal Data Objects
    var Views = new Array();
    var cameraRotate = cameraRotateObject;
    // Internal State Variables
    this.ShouldUpdate = false;
    var FirstUpdateHappened = false;
    var timeline = new TimeLineObject();
    var FromView = null;
    var ToView = null;
    var CurrentView = new CameraPosition(null,0,0,0);
    // Public Variables
    this.viewTransitionTime = 2;
    this.smoothness = 1;
    this.getView = function(Name){return Views[Name];}
    this.AddView = function(Name, targetPosition, pitch, yaw, dist)
    Views[Name] = new CameraPosition(targetPosition, pitch, yaw, dist);
    this.AddViewCameraPos = function(Name, CamPos)
    Views[Name] = CamPos;
    this.goToViewWithoutTransition = function(Name)
    cameraRotate.setCameraPos(Views[Name]);
    this.goToView = function(Name)
    FromView = cameraRotate.getCameraPos();
    ToView = Views[Name];
    timeline.start(this.viewTransitionTime);
    this.ShouldUpdate = true;
    FirstUpdateHappened = false;
    this.Update = function(delta)
    if(!FirstUpdateHappened)
    FirstUpdateHappened = true;
    return;
    timeline.update(delta);
    var value = timeline.getEaseInOutValue();//getSmoothedValue(cameraRotate.smoothness);
    var yawDiff = ToView.getYaw() - FromView.getYaw();
    if(yawDiff > Math.PI)
    yawDiff -= (2*Math.PI);
    else if(yawDiff < (-Math.PI))
    yawDiff += (2*Math.PI);
    CurrentView.CamVector.y = FromView.getYaw() + (yawDiff * value);
    CurrentView.CamVector.x = FromView.getPitch() * (1-value) + (ToView.getPitch() * value);
    CurrentView.CamVector.z = FromView.getDistance() * (1-value) + (ToView.getDistance() * value);
    CurrentView.TargetPosition = FromView.TargetPosition.blend(ToView.TargetPosition, value);
    cameraRotate.setCameraPos(CurrentView);
    if(!timeline.getRunning())
    this.ShouldUpdate = false;
    //====================================================================
    //======== End - ViewManager.js
    //====================================================================

  • How can i transfer my music from one account to another on a different computer?

    So i have an itunes account on dell laptop and i share that account with other famliy members. I recently bought a mac pro and wanted to create a new account that way i can use icloud, is there any possible way to transfer everything from my old library to my new one or will i lose everything i had on my phone and ipods? Or is it possible to have one account but multiple icloud accounts?

    lisafromwindermere wrote:
    I want to start my own account separate from my parents. Can I transfer my music from one account to another? If so, how?
    Lisa,
    Just get copies of the song files and add them to your iTunes library.  With the exception of any DRM-protected files (purchased before mid-2009 and never upgraded) they will play fine, even though they are technically associated with the original account.

  • How can i move music from one account to another

    I have 4 different accounts in Itunes and i wish to move all the music into one account
    help please !!!!

    You can't transfer content from one account to another account, nor can you merge accounts - content will remain tied to the account that downloaded it

  • How can I transfer sapscript from one client to another

    Please tell me the steps , how can I <b>transfer</b> SAPscript from one client to another (like DEV Client to Test Client)?

    Hi,
    Utilities --> Copy from client.
    If you have to copy from once system to another use Program RSTXSCRP
    Regards,
    Satish
    Message was edited by:
            Satish Panakala

  • How can I transfer mailboxes from one computer to another?

    How can transfer all mailboxes(and their contents from one MBP to another? Migration assistant was no help.

    Select all your mailboxes, and then select
    Mailbox ▹ Export Mailbox...
    from the Mail menu bar. Export the mailboxes to the Desktop folder. Transfer them to the new machine.
    On the new machine, import the mailboxes:
    File ▹ Import Mailbox...

Maybe you are looking for