Efficientl​y building an array of increasing values for a graph

I need to build an array of values increasing by 3E-8.  Initializing an array and changing each value in a while loop works fine, but it is terribly slow.  Is there a better (faster) way of building an array of increasing values like this?

Thanks for the suggestion, it looks like that could do what I'm looking for.  A kind tech solved the problem for me by phone -- I knew it was reading and writing the entire 100,000 element matrix to memory at each step, but I couldn't figure out how to get it to stop.  A shift register brought the run time from over 2 minutes to under 1 second.
Thanks again for responding!
Message Edited by Deamiter on 11-07-2006 06:46 PM

Similar Messages

  • Building an array of difference values

    Dear Forum Members,
    With reference to the attached LabVIEW 2010 Student Edition file....
    From the incoming data via the .csv 'Read From Spreadsheet' I want to display an array of the difference between the n and n-1 data value i.e. if the data set is 10, 20, 25, 35, 50 then the difference will be 10, 5, 10, 15.
    I have used the 'Index Array' function to extract the n and n-1 data values (using the 'Simulation Time' function as the Index Row incrementer) however I cannot find the way to build an array of these difference values and display them in the Front Panel i.e.
    10
    5
    10
    15
    This will no doubt be a trivial issue for those more experienced LabVIEW programmers.  Any advice or assistance will be gratefully received.
    Kind regards,
    Solved!
    Go to Solution.
    Attachments:
    Plant_Simulator (04-05-2013).vi ‏158 KB

    I'll explain what I want to do again for clarity....
    I have a simple spreadsheet file (in .csv format) that contains one (1) column of data x 800 rows (thats 800 elements).  I read the data into LabVIEW via the 'Read from Spreadsheet' function (I have already established this).  I then want to make an array that is the difference beween the n and n-1 data value.  Hence if the data set is 10, 20, 25, 50... then the difference will be 10, 5, 25..
    I want to display the difference array to screen in an indicator that shows all the difference values in one (1) column x 799 rows.  Hopefully that explains what I want to achieve.
    I tried the suggestion with the loop however there were multiple errors when this was attempted.  I cannot place the loop within the simulation frame (it doesn't allow it) hence its outside.
    Please excuse my inexperience concerning the array order(s), I find LabVIEW to be particularly unfriendly in this respect and its the source of much of my frustration and pain whenever I'm using LabVIEW to implement anything.
    Regards,

  • Build an array with 2 values assigned to 1 dimension

    I am wanting to build a 1D array where two values are assigned to each dimension.  For example:
    Index 0 would have a 1 and 4 assigned to it
    Index 1 would have a 2 and 3 assigned to it
    Index 2 would have a 0 and 1 assigned to it.
    Then I can unbundle this arrayand grab the two values for index 0, index 1, etc....  I want to put this array inside a typedef control.  Is this possible?
    Solved!
    Go to Solution.

    Thanks for the replies.  I considered using a cluster and had the typedef control modified to include the cluster.  I may just go back to this method if this is the simplest for the code I am modifiing.
    A 2D array assigns two values i.e. row and column to one number.  I need it the other way around.
    Here is what I am trying to do.  I need to control a rotary valve.  I am using compact filedpoint to control the rotary valve.  The valve requires a pulse (1 then 0) for the rotary valve to move 1 position. If the valve is on channel 1 of the fieldpoint module and I want it to turn to position 2, the I send two pulses to channel 1. 
    My thinking is I will have two values associated per rotary valve... a channel and a pulse value. So for example, valve 0 has a Boolean and a numeric value assigned to it in an array. Although, it doesn't have to be a boolean and a numeric.  it could be 2 numeric values for simplicity.
    I hope this makes sense because without knowing this posting a VI or image is useless.  Its the chicken before the egg thing. :-)

  • Need an ARRAY of the values for the user to see the array values

    how would I display the values to the user in an array?????
    for all three loans in my java code
    import java.text.*;           //20 May 2008, Revision ...many
    import java.io.IOException;
    class memortgage     //program class name
      public static void main(String[] args) throws IOException
        double amount,moPay,totalInt,principal = 200000; //monthly payment, total interest and principal
        double rate [ ] = {.0535, .055, .0575};          //the three interest rates
        int [ ] term = {7,15,30};                        //7, 15 and 30 year term loans
        int time,ratePlace = 0,i,pmt=1,firstIterate = 0,secondIterate = 0,totalMo=0;
        char answer,test;
        boolean validChoice;
        System.in.skip(System.in.available());           //clear the stream for the next entered character
        do
          validChoice = true;
          System.out.println("What Choice would you Like\n");
          System.out.println("1-Interest rate of 5.35% for 7 years?");       //just as it reads for each to select from
          System.out.println("2-Interest rate of 5.55% for 15 years?");
          System.out.println("3-Interest rate of 5.75% for 30 years?");
          System.out.println("4-Quit");
          answer = (char)System.in.read();
          if (answer == '1')  //7 yr loan at 5.35%
            ratePlace = 0;
            firstIterate = 4;
            secondIterate = 21;
            totalMo= 84;
          else if (answer == '2') //15 yr loan at 5.55%
            ratePlace = 1;
            firstIterate = 9;      //it helps If I have the correct numbers to calcualte as in 9*20 to equal 180...that why I was off -24333.76
            secondIterate = 20;    //now it is only of -0.40 cents....DAMN ME
            totalMo = 180;
          else if (answer == '3') //30 yr loan at 5.75%
            ratePlace = 2;
            firstIterate = 15;
            secondIterate = 24;
            totalMo = 360;
          else if (answer == '4') //exit or quit
            System.exit(0);
          else
            System.in.skip(System.in.available());               //validates choice
            System.out.println("Invalid choice, try again.\n\n");
            validChoice = false;
        }while(!validChoice);  //when a valid choice is found calculate the following, ! means not, similar to if(x != 4)
        for(int x = 0; x < 25; x++)System.out.println();
        amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
        moPay = (amount / totalMo);
        totalInt = (principal * rate[ratePlace] * term[ratePlace]);
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println("The Interest on $" + (df.format(principal) + " at " + rate[ratePlace]*100 +
        "% for a term of "+term[ratePlace]+" years is \n" +"$"+ (df.format(totalInt) +" Dollars\n")));
        System.out.println("\nThe total amount of loan plus interest is $"+(df.format(amount)+" Dollars.\n"));
        System.out.println("\nThe Payments spread over "+term[ratePlace]* 12+" months would be $"+
        (df.format (moPay) + " Dollars a month\n\n"));
        System.in.skip(System.in.available());
        System.out.println("\nWould you like to see a planned payment schedule? y for Yes, or x to Exit");
        answer = (char)System.in.read();
        if (answer == 'y')
          System.out.println((term[ratePlace]*12) + " monthly payments:");
          String monthlyPayment = df.format(moPay);
          for (int a = 1; a <= firstIterate; a++)
            System.out.println(" Payment Schedule \n\n ");
            System.out.println("Month Payment Balance\n");
            for (int b = 1; b <= secondIterate; b++)
              amount -= Double.parseDouble(monthlyPayment);
              System.out.println(""+ pmt++ +"\t"+ monthlyPayment + "\t"+df.format(amount));
            System.in.skip(System.in.available());
            System.out.println(("This Page Is Complete Press [ENTER] to Continue"));
            System.in.read();
    }

    skull_innocent wrote:
    whooooooo...dang....just tell me nicely .
    Sorry.
    I thought that this question I submitted in the wrong area previously
    There are better ways to correct me in my errors for posting
    I am sorry.Okay, no harm done.
    I hope that you understand that a major beef of contributors here is to spend time answering a question, only to later discover that somebody else has posted a similar answer in another thread. Hence the annoyance at crossposters.
    In the future, if you think you've posted in the wrong forum, or if for whatever reason you decide to post in multiple forums, pick one thread as the "main" one and provide a link to it in the others.

  • SSRS (Report Builder 3.0) Showing all values for Multiple Line field with Append Changes

    I have a simple SharePoint list with a multiple line column that has append changes enabled. I am doing a report with Report Builder 3.0 and I want to show all values of the field the same way you achieve it through a DVWP using:<SharePoint:AppendOnlyHistory
    FieldName="Comments" runat="server"
    ControlMode="Display" ItemId="{@ID}"/>
    Any suggestions to show all the appended values?

    Hi,
    I am trying to involve someone familiar with this topic to further look at this issue.
    Regards,
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Rebecca Tu
    TechNet Community Support

  • BO-how do we get unique summerised value for both graph and table

    When we add the column it shows 15 but when we create a graph with the same column and week no column it is taking distinct value resulting 7 as sum please let me know if there is any option to remove distinct values.

    "Index your foreign keys if you EVER
    o update parents primary key
    {code}
    When a deadlock is to due to a _unindexed FK_, the corresponding deadlock graph should at _least show one TM_ (DML enqueue). This is not the case here. So, unindexed FK are not the case here
    Mohamed Houri                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Best Way To Build An Array Of Many Elements

    Simple question for you LabVIEW experts: I want to build an array of many element for use in my code.  The problem is I have 20 elements I need to insert into the "Build Array Function."  This takes up much code space and is really not that clean.  I was thinking of using a For Loop and use the iteration terminal as the index for each element.  The For Loop would then use auto indexing and build this array for me.
    Is there a more efficient way to do this?  Thanks!

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Build Array and Output Values to Text or Excel File

    I know this is a simple question but I need some help. I'm reading a DC voltage in LabVIEW a while loop. I want to store all the read values into an array and export that array as an text or Excel file. I had a VI that I build before for this but I cannot seem to find it and I can't remember how I did it before. Any help is appreciated. I think I can do the exporting part but I do help with building the array (storing all the data values).

    I run into a problem while using the "Write to Text File Function". Initially I took about 60 measurements and wrote to a text file. That works but I increased the amount of measurements to be taken to 600 and when I did that the output in the text file are all Chinese letters (or that's what it seems like). Is this because I'm writing too much data?
    When I use the "Write To Spreadsheet File VI" to write the measurments it works fine for the 600 measurements. The problem with this is I cannot insert any text. Using the "Write to Text File Function" I inserted some text before the measurements and "end of lines", to format the data. Attached is a screenshot of my VI.
    Attachments:
    measurements.PNG ‏45 KB

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to build a array with high sampling rates 1K

    Hi All:
    Now I am trying to develop a project with CRio.
    But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data)
    Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I found it is not working for high sampling rates.
    Is there anyother good way to build a data arrary for high sampling rates??
    Thanks
    Attachments:
    Building_Array_high_rates.JPG ‏120 KB

    Can't give a sample of the FPGA right now but here is a sample bit of RT code I recently used. I am acquiring data at 51,200 samples every second. I put the data in a FIFO on the FPGA side, then I read from that FIFO on the RT side and insert the data into a pre-initialized array using "Replace Array subset" NOT "Insert into array". I keep a count of the data I have read/inserted, and once I am at 51,200 samples, I know I have 1 full second of data. At this point, I add it to a queue which sends it to another loop to be processed. Also, I don't use the new index terminal in my subVI because I know I am always adding 6400 elements so I can just multiply my counter by 6400, but if you use the method described further down below , you will want to use the "new index" to return a value because you may not always read the same number of elements using that method.
    The reason I use a timeout of 0 and a wait until next ms multiple is because if you use a timeout wired to the FIFO read node, it spins a loop in the background that polls for data, which rails your processor. Depending on what type of acquisition you are doing, you can also use the method of reading 0 elements, then using the "elements remaining" variable, to wire up another node as is shown below. This was not an option for me because of my programs architecture and needing chunks of 1 second data. Had I used this method it would have overcomplicated things if I read more elements then I had available in my 51,200 buffer.
    Let me knwo if you have more qeustions
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    RT.PNG ‏36 KB
    FIFO read.PNG ‏4 KB

  • Issue with building an array from a cfhttp request result.

    Here is what I am trying to do. Retrieve a bunch of results from a  REST request. Run a query to see if I should be excluding any of the xmltext entries coming back from the rest request. Build an array of the REST xmltext entries except the entries in the cfquery.
    I have it all workign except building the array minus the entries that came back in the cfquery. Here is my code so far.
    <cfquery name="getqueue" datasource="#application.settings.dsn#">
    select * from friends
    where Deactivatedate < #DATEADD('d', 1, CreateODBCDateTime(now()))#
    </cfquery>
    <cfoutput query = "getqueue">
    <cfhttp  blah blah>
    <cfset nodes_parse = XmlParse(CFHTTP.FileContent)>
    <cfset Nodes = xmlSearch(nodes_parse,'friends/friend/date/activedate/')>
    <cfset roleArray = ArrayNew(1)>
    <cfloop from="1" to="#arraylen(Nodes)#" index="i">
       <cfset NodeXML = xmlparse(Nodes[i])>
    <cfset ArrayAppend(roleArray, '[sel_members][]=#NodeXML.activedate.xmlText#&')>
    </cfloop>
    </cfoutput>
    My issue is down in the loop where I do the arrayappend. How would I build an array of values coming back from the cfhttp request but not include any of them if they match up with anything coming back from the getqueue query?

    What about the obvious? Namely,
    <cfif value_from_getqueue IS NOT value_from_cfhttp_request>
    <cfset arrayAppend()>
    </cfif>

  • Building an array to a specified format..

    I'm trying to build an array that follows a specified output format. The user inputs columns & rows e.g. C x R...amd the the output should read
    C1 C2 C3 C4.....
    R1 V V V V....
    R2 V V V V ...
    Where each V is not a constant, but a user inputed value. Sorta like a matrix in appearance.
    Any ideas??

    You can use a table control and use a property node to set the number of rows and columns. But that just sets the number of rows and columns which are visible. The user can navigate to additional rows and columns.
    You could create an event structure to keep the user within the specified bounds. You could also remove the scrollbars (right-click on table, goto Visible Items, the deselect Horizontal Scrollbar and Vertical Scrollbar).

  • How to assign values for boolean array in LabVIEW?

    I want assign values for boolean array.Iam not able to do that.For each boolen i want to assign each value.Plz help me......
    Please Mark the solution as accepted if your problem is solved and donate kudoes
    Solved!
    Go to Solution.

    Hi agar,
    values in an array are "assigned" by building an array (using BuildArray) or by replacing values in an existing array (ReplaceArraySubset)!
    Good starting point could be this...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Best way to create an array of bound values (to the resourceManager for example)

    What's the best practice for creating an array (array collection) where each element is bound to another value?
    An example would be an array of error strings that are used by an application.  Each string needs to change as the resource manager changes.
    Passing a list of strings to a list control is another example.  These should get localized as well.

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Methods to build an array inside a For Loop.

    Let me introduce to you my nested For Loops:  
    They output a 2D boolean array depending on two 1D boolean arrays of different lengths.  This is all well and good however, in another part of my program, I want this to be a 1D array instead.
    Idea #1:
    "I'll just reshape the array at the end. Simples!"
    Idea #2:
    "Hang on, why am I using three primitives outside the loop when I can use just one inside it along with a shift register?"
    Idea #2.5:
    "Oh, wait... I remember reading somewhere about continuously building an array (with concatenate inputs) inside a loop being a bad thing and quite slow. Let me test this."
    Spoiler (Highlight to read)
    Idea #3:
    "Umm... okay, so actually the second way is faster.  I think if I initialize the shift register first then replace subsets of the array, that might also be better."
    Spoiler (Highlight to read)
    Idea #4:
    "Yep - seems much better. (Something to do with LabVIEW not having to constantly allocate more memory on every iteration of the loop)  Looking at this closer, I don't actually need the inner For Loop because of the way I'm handling the arrays.  Try again...!"
    Spoiler (Highlight to read)
    Conclusion(?) #1:
    "Well I seem to have arrived at something that looks messier, but executes about 6x faster than my initial idea. That said, the difference rapidly increases as the input arrays get much bigger (becoming orders of magnitude different)."
    Is this the most efficient way of doing what I want?  Or is there something even better (and works in LV 8.5)?
    Never say "Oops." Always say "Ah, interesting!"

    Thank you both for the feedback.  It never occurred for me to recheck the logic after I'd initially extracted the nested For Loops, but the AND gate output is obviously the same now that it's been pointed out!
    Continuing on with Idea #4, I replaced the Select with an AND then compared the times.  (also meant I didn't have to initialize one of the arrays anymore)
    Spoiler (Highlight to read)
    It appears that the AND gate was slower but then I tried with different sizes of initial arrays and in one case, the timings were 'reversed'.
    This only happened when the top array (the one that is fed into the AND gate whole) was reduced to a length in the region of 5 elements long.
    Spoiler (Highlight to read)
    Why does this happen?  Is it something to do with the AND gate possibly being optimised for single element operations so smaller arrays are handled better...?
    Never say "Oops." Always say "Ah, interesting!"

Maybe you are looking for

  • Using a tool to add, modify or remove rows in a database table

    I am making a web application in Sun Java Studio Creator, but I have one specific question. I have a database with table ‘Customers’ and in the interface of my application an admin can add, modify or remove a customer. In programs like Microsoft Visu

  • Imovie malfunction

    I've been using Imovie on this machine for a over a year now and it has been working just fine. My usual procedure is to connect my Sony Mini DV camcorder via firewire. When I open Imovie, I set it to save the clips and project to external harddrive

  • Control quicktime video loading external with lingo

    Hello: I have a director 11.5 movie in wich I need to show several quicktime videos. When the user click button  one (5 buttons) the video 1 plays. Is possible in the same Director movie to loadthe requested video changing the cast or sprite in fly?

  • Set amount value for DBMS_LOB.READ

    Hi, I set the amount for DBMS_LOB.READ and it can only read CLOBs under 32KB. Any advice? Thanks. v_amount NUMBER := 32767 ; DBMS_LOB.READ(CLOB , v_amount, v_offset, v_buffer);

  • Color shift

    I have Lightroom 2, I upload files as DNG files, edit in Lightroom, then export to ProShow Producer as Jpg files. The files that open look like DNG unedited files, very dull and flat.  I expect some color shift but this is very bad.  I need to ed it