Rearrange data with correct array size

My VI is trying to rearrange the 2D array that I read from test.xls file, so that each function is get separated with there data in it.
Look over the test.xls file that I have attached. It has 2 columns. Both contains couple functions designated with ) and (. So, ACU_PGM is considered a function. I have rearranged the data so when ACU_PGM (or PGM is selected) the data following it is data for PGM before another function starts, which is KEY and 500 in this case. Same way for all other functions. Each column always ends by );
)ACU_PGM( )CAB_INP(
KEY WRITE
500 50
)ACU_DIA( 3
DM1 0
1010.1 )CAB_CLC(
0 WRITE
PROTECT 50
DM2 3
101.23 0
10 NA
NA )CAB_CRX(
); TEMP_1
3
0
The problem with my current design is I am initializing array with 0x0 size, once it gets the 1st function it gets initialized with that same size of that function array for that entire column's fnction, so it want take more elements if 2nd function in same column have more elements like in this case. ACU_DIA has 8 elements but it will only take 2 elements as ACU_PGM has 2 in it.
Please look over the Get_function.Vi only half portion. I have instructions in text in Vi also. I saw that columns are not lookin good after I submit the question so please open test.xlx file to see actual data Thank you.
Attachments:
test.xls ‏14 KB

Hi Amy,
I see what you're talking about. The Insert Array function truncates the data to the length of elements that are already existing in the array. There are a couple ways you could get around this. The easiest way would be to not preallocate a 2D array. Instead, you would just use the Build Array function to keep making the array as large as you need (see attached VI for an example: Get_Function[mod] - written in LabVIEW 7.1). Another way to do it is to keep reallocating memory for a new array everytime you want to "insert" data. This is essentially what the Build Array method will be doing.
Hope this helps!
Travis H.
LabVIEW R&D
National Instruments
Attachments:
Get_function[mod].vi ‏38 KB

Similar Messages

  • Get data with correct array size

    My VI is trying to rearrange the 2D array that I read from test.xls file, so that each function is get separated with there data in it.
    Look over the test.xls file that I have attached. It has 2 columns. Both contains couple functions designated with ) and (. So, ACU_PGM is considered a function. I have rearranged the data so when ACU_PGM (or PGM is selected) the data following it is data for PGM before another function starts, which is KEY and 500 in this case. Same way for all other functions. Each column always ends by );
    )ACU_PGM( )CAB_INP(
    KEY WRITE
    500 50
    )ACU_DIA( 3
    DM1 0
    1010.1 )CAB_CLC(
    0 WRITE
    PROTECT 50
    DM2 3
    101.23 0
    10 NA
    NA )CAB_CRX(
    ); TEMP_1
    3
    0
    The problem with my current design is I am initializing array with 0x0 size, once it gets the 1st function it gets initialized with that same size of that function array for that entire column's fnction, so it want take more elements if 2nd function in same column have more elements like in this case. ACU_DIA has 8 elements but it will only take 2 elements as ACU_PGM has 2 in it.
    Please look over the Get_function.Vi only half portion. I have instructions in text in Vi also. I saw that columns are not lookin good after I submit the question so please open test.xlx file to see actual data Thank you.Message Edited by Amy222000 on 06-02-2005 03:44 PM
    Attachments:
    get_function.zip ‏795 KB
    test.xls ‏14 KB

    Duplicate Post
    E. Sulzer
    Applications Engineer
    National Instruments

  • Rearranging data in an array

    I am having an input array in which i am reading data from csv file, i want to rearrange the data, so as to present it in presentable format, i have tried some operations but not getting exactly how to do.
    below i am attaching the vi which contains the input array and the expected data.
    Attachments:
    File formatting.vi ‏17 KB

    Chinmay_NI
    I am getting one problem in the program, the solution you posted is working fine for me, but the problem is that i am having larger set of data in input array in which i am having version number and other things more than once and Vbat and othe things are also not constant i tried to fix these issues but stil not getting the result as expected, if you can help me i n sorting out this one issue
    Thankyou
    below i am attaching program, 
    Attachments:
    file formatting.vi ‏23 KB

  • Creation of PDF with different page sizes

    I am generating PDF using Acrobat Distiller from my application from the .ps file. From one machine, the PDF is generated with different page sizes.one page with 8.5*12.99 and other pages with 8.5*11 in the same PDF. However the PDF is created with correct page sizes for all the pages in another machine. The only difference between the machines is the Internet Explorer version. I am using Internet explorere 11.0 and the other machine have a version of 8.0 installed.
    Why the difference in page size occured? Is there any dependency on the Internet explorer used while creating the PDF using Distiller? Any help for the issue with the discrepancy in the page sizes is really appreciated.
    Thanks!

    Acrobat Distiller uses the page size in the PS file. May be a problem of your application which create the PS file.

  • How do I determine array size in a formula node

    I am feeding an array into a formula node to perform an operation on. However the size of the array can be an arbitrary size. How can I determine its size to use for iterating through a for loop?
    I suppose that I could add another input that is fed with the array size from the array palate but I would like to know if it can be done inside the formula node itself.

    Your own advice is the only and best one.
    greetings from the Netherlands

  • Data type of preprend array size in Flatten To String block

    Hi 
    The data type of the preprend array size in Flatten To String block is given as I32. Is it somehow possible to reduce the data type to I8, since the width and height of my array won't exceed 255 ?. I also need to do the same in Unflatten To String as well. 
    Best regards
    Oesen

    Oesen wrote:
    Hi 
    The data type of the preprend array size in Flatten To String block is given as I32. Is it somehow possible to reduce the data type to I8, since the width and height of my array won't exceed 255 ?. I also need to do the same in Unflatten To String as well. 
    The short answer is no.  This is because the index is an I32.  NI likes to keep integers as an I32 whenever possible for reasons like this.
    Since you are dealing with a 2D array (width and height), it will actually use 2 I32s before the actual data.
    As Ravens stated, you could put in your own array sizes before the array in the string.  But it is worth saving 6 bytes?  Not likely.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How I average data with 78,74,73 and 55 points respectively and end up with an array of 78 points for the average?

    Hi
    As the questions states, how do I average data with 78,74,73 and 55 points respectively and obtain an array of 78 points? 
    When I use the plus vi, Labview somehow produces an array of 55 points when I do the average (see attached vi).
    I have been unlucky in trying to get good results.
    Can anyone help?
    Thank you.
    Attachments:
    average4.vi ‏40 KB

    The add function is polymorphic. It accepts arrays as well as numerics, but you need to understand one thing about array operations in LV. Operations performed on arrays of different sizes will always (I think) work based on the smallest array. For example, if you auto index 2 arrays of different sizes into a for loop, the number of times the loop will run will be the size of the small array. The same is true here - when you wire 2 arrays of different sizes to the add function, only the first N elements of the larger array get processed. The rest are dumped. That's why you get 55 elements.
    Attached is a modification of your VI which shows 2 things:
    The bottom part is your algorithm, only cleaned up. Note how much easier it would be to read now. You should always write clean code. Also, note that I have changed the representation on some of the data from DBL to I32. This is because this is the representation the array function work with and your code had the DBLs coerced for no reason.
    The top part is a different algorithm which should do what you want. Note that like Mike said, the arrays with smaller sizes will have 0s appended at the end, so if you want to avoid that, you will have to modify the last part, where the averaging is done and only divide those columns which are long enough.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!
    Attachments:
    average4MOD.vi ‏63 KB

  • Array Size doesn't work correctly after "Auto-indexed Tunnel"

    Array Size returns value even if Empty Array is detected after "Auto-indexed Tunnel" tha generates 2D array.
    See example + VI with correct output as I expected.
    OR
    There is problem with generating 2D array --- It's empty. 1D array is generated in right way. 100 x 0 but not Emptu Array.
    Attachments:
    ArraySize_Bug.vi ‏9 KB
    ArraySize_Corrected.vi ‏19 KB

    Not a bug. This is correct behavior that is consistent with other parts of LabVIEW.
    The decision to handle multi-dimensional arrays like this was made long ago and is an enshrined part of the LabVIEW language spec. It will not be changed.

  • Array to cluster with adjustable cluster size

    Hi all
    Here I have  a dynamic 1D array and I need to convert it into cluster. So I use Array to Cluster function. But I notice that the cluster size is a fix value. How can I adjust the cluster size according to the 1D array size?
    Anyone pls give advise..
    Thanks....

    I won't disagree with any of the previous posters, but would point out a conversion technique I just recently tried and found to work well for my own particular purposes.  I've given the method a pretty good workout and not found any obvious flaws yet, but can't 100% guarantee the behavior in all settings.
    Anyhow, I've got a fairly good sized project that includes quite a few similar but distinct clusters of booleans.  Each has been turned into a typedef, complete with logical names for each cluster element.  For some of the data processing I do, I need to iterate over each boolean element in a cluster, do some evaluations, and generate an output boolean cluster.  I first structured the code to use the "Cluster to Array" primitive, then auto-index over the resulting array of booleans, perform the evaluations and auto-index an output array-of-booleans, then finally convert back using the "Array to Cluster" primitive.  I, too, was kinda bothered by having to hardcode cluster sizes in there...
    I found I could instead use the "Typecast" primitive to convert the output array back to my cluster.  I simply fed the input cluster into the middle terminal to defin! the datatype.  Then the output cluster is automatically the right size and right datatype.
    This still is NOT an adjustable cluster size, but it had the following benefits:
    1. If the size of my typedef'ed cluster changes during development by adding or removing boolean elements, none of the code breaks!  I don't have to go searching through my code for all the "Array to Cluster" primitives, identifying the ones I need to inspect, and then manually changing the cluster size on them one at a time!
    2. Some of my processing functions were quite similar to one another.  This method allowed me to largely reuse code.  I merely had to replace the input and output clusters with the appropriate new typedef.  Again, no hardcoded cluster sizes hidden in "Array to Cluster" primitives, and no broken code.
    Dunno if your situation is similar, but it gave me something similar to auto-sizing at programming time.  (You should test the behavior when you feed arrays of the wrong size into the "Typecast" primitive.  It worked for my app's needs, but you should make sure it's right for yours.)
    -Kevin P.

  • HT203167 My iTunes library on laptop is correct/up to date with recent purchases and downloads; however, our desktop computer does not have any of these when logged into Itunes.... how do I add these so both computers have current info?

    The iTunes library on our laptop is correct and up to date with recent purchases and downloads; however, our desktop does not have any of these when using it.  Home sharing is turned "ON" with both computers. Why is the desktop not showing the same content and how do I resolve this?

    From your OLD computer...
    Copy your ENTIRE iTunes FOLDER to an External Drive... and then from the External Drive to your New Computer..
    Full Details Here  >  http://support.apple.com/kb/HT1751
    Also see this migrate iTunes library post by turingtest2

  • Save waveform data with corresponding time array to spreadsheet file

    Hello to all
    I am looking for a possibility to save voltage data acquired and displayed continousely to a spreadsheet file. Acquiring and displaying is not a big problem, but I have troubble to save the data with the corresponding timestamp with more than seconds accuracy. I am acquiring the data at 1000 Hz and read packages of 500 samples. The recording time should not be limited, it will be started and stopped manually. In fact the acquired voltage data first has to be scaled and than saved. If I use the 'WRITE WAVEFORM TO SPREADSHEET' VI the time column is in seconds' accuracy and that is not what I need. If I create my own time array from the waveform parameters I have timing problems. The accuracy in time should reflect the sample rate. I will attach one of my not very successful trials for better understanding.
    please help a newcomer!
    Thanks in advance
    Thomas
    LV 7.1
    Attachments:
    display & record forces v.1.0.vi ‏181 KB

    I usually follow a simple method to generate time stamp
    I keep sampling rate and number of samples to read as equal and do as shown in the attached VI
    I also remember building a VI with a small modification to this time stamp generation logic to cater to acq, where number of samples to read is half/one fourth/one tenth of sampling rate specified, but cannot find that VI.
    Hope this helps
    Regards
    Dev
    Attachments:
    Acq_DAQmx_filesave_time stamp.vi ‏121 KB

  • Videos in iPhoto used to export with correct date, no they don't.

    Hello, I use iPhoto a lot. About every 6 months I rename and export my photos and videos to a separate portable hard drive for safe storage.
    I am doing that right now, but have noticed that my videos do not export with the correct date (changes the date to the export date), and therefore the videos are not going to be in the right order, and will not have the correct date on my backup files. The pictures export properly with correct date. Just the videos are the problem.
    This problem did not exist before. What has changed? Is there a way to export my videos and retain the correct date again?
    Thank you!

    Thank you for the quick reply Terence!
    Is this something new for Maverick, or new iPhoto update? I have always been able to export video with the correct date. Even when I imported it back into iPhoto later, the correct date was there. I think I updated to Maverick after my last renaming and exporting session.
    I have found that if I drag the video from iPhoto to my desktop, it keeps the correct date on the file and the video is intact. So there must be some sort of "metadata" in the file that has the correct date?? You probably have the knowledge to experiment with this??
    Just seems weird, because for years it was just fine. Now it is not.
    How did the videos used to keep the correct date?
    Thank you.

  • Do we need to format data and log files with 64k cluster size for sql server 2012?

    Do we need to format data and log files with 64k cluster size for sql server 2012?
    Does this best practice still applies to sql server 2012 & 2014?

    Yes.  The extent size of SQL Server data files, and the max log block size have not changed with the new versions, so the guidance should remain the same.
    Microsoft SQL Server Storage Engine PM

  • Array output from formula node with input variable as array size

    Hi,
    I have created a formula node with an array output called al, but I get an error "you have connected a scalar type to an array with that type".
    I declare the output as follows..
    float64 al[len_as];
    where len_as is an scalar input to the formula node.
    It only works when I put a number as.
    float64 al[5];
    ,but I don't know beforehand how many elements I need, so I cannot use this.
    Please help! This is so stupid.
    Thanks

    Don't define your array in your formula node.
    Initialize the array as the size you want and pass it in as an input into the formula node.
    Are you sure you even need to use a formula node?  Can you implement your formula using all native LabVIEW functions?
    Message Edited by Ravens Fan on 10-07-2009 11:51 PM
    Attachments:
    Example_VI_BD.png ‏3 KB

  • Help with parallel arrays of different data types

    Hello all, I am having an issue with parallel arrays. My program requires me to read information from a text file into 4 parallel arrays (2 String and 2 double). My text file needs to look something like this:
    John Johnson
    0000004738294961
    502.67
    1000.000
    Jane Smith
    0000005296847913
    284.51
    1000.000
    ...and so on
    Where the first thing is the name (obviously), an account number, the balance in the account, and the credit limit. I just cant figure out how to read everything into the arrays. We havent learned anything too heavy, and this seems a little too advanced for my class, but I guess we will manage. Any help will be appreciated. Thanks guys.
    Casey

    Man this is a dumb homework assignment. The requirements scream out for a class along the lines of
    public class Account{
      private String name, number;
      private double balance,creditlimit;
       // more code here
    }and then to use a List of Account objects.
    Anyway what's your actual problem. There's nothing very hard about it. A loop. So....
    You should consider posting (formatted) code showing what you have done and where exactly you are stuck.

Maybe you are looking for