Spreadsheet to array

Hi,
I am trying to read from a spreadsheet.
PressDir=-1,1,-1,1
how would I make this work?
I think my conversion code is wrong. 
But I have tried everything.
Message Edited by krispiekream on 04-06-2010 11:13 AM
Best regards,
Krispiekream
Solved!
Go to Solution.

TurboPhil wrote:
Judging from your screencapture, it looks like you want your variable "PressDir" to be represented as an iteger. Therefore, I assume you want to be able to read in a spreadsheet string as a boolean array, and then format the boolean array into an integer. (i.e. the array [1,0,0,1] would translate to the number 1001 in binary, or 9 decimal).
Many things don't make a lot of sense here. Why would you scan it as a DBL array since there are only integers? The original problem has 1 and -1, not 1,0, and we don't know what other possible value there are, maybe -1, 0, 1? I also would not reverse the array, else you get assignment problems if the length changes.
Here'as one possible alternative, showing both how to make a -1, 1 array and a bit representation of it.
Message Edited by altenbach on 04-06-2010 12:28 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
array.PNG ‏9 KB

Similar Messages

  • Spreadsheet to array memory problems

    I'm trying to read a large .csv file (329 MB) and display a user selected column of data on a graph.  I have a standalone executable that does this wonderfully, however, I cannot contact the developer of this application to ask questions.  I just have the standalone executable, no code.  So I'm trying to write my own application with a slight modification.  The problem is I run out of memory for LabVIEW. 
    In the standalone execution the memory usage is as follows:
    515 MB - baseline memory usage
    523 MB - application starts
    1.25 GB - open 329 MB .csv file
    1.5 GB - open additional 63.6 MB .csv file
    Data from the first column is displayed on a graph.  Memory usage does not seem to change at all when I'm selection columns from either file for plotting on the graph.  CPU usage is also minimal when selecting columns; at most an occasional spike of 20%.
    In my application the memory usage is as follows:
    515 MB - baseline memory usage
    587 MB - LabVIEW starts
    598 MB - application starts
    657 MB - open 63.6 MB .csv file
    1.10 GB - convert spreadsheet string to 2D array
    2.04 GB - replace 1st row
    and then LabVIEW runs out of memory.  I've enclose the subVI that actually reads the .csv file and converts it to a 2D array.  Why is LabVIEW running out of memory for my application and not the standalone application?  Theories?
    Attachments:
    ExtractPortion.vi ‏33 KB

    Hey all,
    The in place element structure should be relatively straightforward, once you understand the concept behind it, which is that it keeps everything in the same memory location and does think about resizing it. Thus, deleting items in an in place structure would not function. Replacing items should however, as discussed in this help document: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/in_place_element_structure/ and as shown here:
    I tried to reproduce your issue, but I managed to make both notepad and word crash in the production of a large enough CSV file. My recommendation is go ahead and split the file up if at all possible. Since you said the code fails on the delete node, you could also simply use the array subset function to pull out all but the line you want to delete, rather than asking labview to give you a second memory location. On the other hand, on my computer the problem occurs at the VI which converts to a spreadsheet string--however, if I set .csv to false (meaning that VI does not have to convert to a float) it does not have a problem. My suggestion would be to convert it to a string first, then use the in place element structure to convert items one by one to the %f format, rather than %s. This is especially true since you are converting string to %f and then back to string (because you selected a 2-d string array as your output).
    Thanks,

  • Read from spreadsheet to array of strings

    Hi
    I need help to build a 1D(string) array from a MS Excel file. I've tried using read from spreaaadsheet/ read from Meaurement file. I'm unable to do this. The excel file contains alpha-numeric data. please suggest with some example vis.
    input would be the excel file path
    output would be a 1D array of strings
    Thank you 
    Solved!
    Go to Solution.

    hi i've updated the program. i'm getting an output but, the output array comes out as comma delimited elements. how do i seperate them??
    Attachments:
    fp.png ‏11 KB
    bd.png ‏5 KB
    spreadsheet.png ‏3 KB

  • Can more than one delimiter be use at the same time for spreadsheet string to array

    I have a text header in my data file that is space delimited and the data in the file is tab delimited? Any suggestion?

    Sorry, I misread your problem...
    Is the header always of a fixed length in terms of the number of lines? Or can you easily find out from the file how long the header is? If so, you could first read just the header and, instead of using spreadsheet to array function, you could parse the header yourself by using the match string function in a While loop with the search value:
    [\s\t]+
    Assuming slash codes are enabled, this string will match any string of one or more spaces or tabs.
    You could then read the rest of the file and format it using spreadsheet to array with the tab delimiter (that is constant, correct?).
    If you need help with that parsing loop let me know and I'll write one for you...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Issues with spreadsheet string to array

    Hi, I have a spreadsheet string (tab delimited) and I am trying to convert it into an array of double with 6 digits of precision after the decimal point. However, as shown in the attached example, the function "spreadsheet to array" is not giving me the desired digit of precision (only 2 after decimal point). I have tried almost everything and I am frustrated with this function. CAN SOMEONE PLZ HELP ME ??
    Attachments:
    Block diagram.png ‏13 KB
    String to array double.vi ‏10 KB
    Panel.png ‏28 KB

    I have no LV 8.x installed, so I can't check your Code. But it might be your settings for the indicator. In LV 7.1 it defaults to 6 significant digits, that means the reading is 12345,6789 but (only) your indicator displays 12345,6.
    Right click on your indicator (Front Panel) and go to formatting.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Spreadshee​t String To Array DBL Performanc​e Improvemen​t

    While developing and profiling a batch data-analysis program, I found that the "Read From Spreadsheet File.vi" function was where the majority ofthe execution time was spent.  Digging further, I found the time was spent in the "Spreadsheet String To Array" function.  Obviously I cannot look inside this function, but I wondered if I can somehow speed it up.  Attached is a Vi that illustrates what I came up with as an alternative.
    Basically using "Spreadsheet String To Array" only to split it up to a 2D String Array, and then "Fract/Exp String to Number" to convert the strings to numbers.
    It consistently runs in just over 60% of the time of using Spreadsheet String To Array on it's own to do the conversion.
    I am curious as to why using the two functions is quicker than just the one on it's own? Perhaps NI can improve the internals a bit?  Or perhaps it is not a fair comparison?
    Labview 8.6f1 Win XP SP2
    Message Edited by pauldavey on 03-25-2009 02:55 PM
    Attachments:
    Speed Test Spreadsheet String to Array.vi ‏26 KB

    Adding a couple of other conversions to test against i noticed that:
    1. Scan from string through a double loop was the slowest
    2. Scan Value was slightly faster
    3. Direct conversion through Spreadsheet to array as in OP
    4. 2-step convert through Fract/Exp.
    Could it be that Spreadsheet to array uses Scan Value internally?
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • String to 2D array

    Hello
    I have large string like this:
    TITLE
    n1
    string1-1
    string1-2
    string1-3
    n2
    string2-1
    string2-2
    string2-3
    n3
    string3-1
    string3-2
    string3-3
    n99
    string99-1
    string99-2
    string99-3
    And I want to create array:
    n1 string1-1 string1-2 string1-3
    n2 string2-1 string2-2 string2-3
    I have tried using Spreadsheet to Array but haw to define delimiter
    Any Suggestions?
    Solved!
    Go to Solution.

    You can convert the String to a 1D Array and then reshape that to get a 2D Array. If you are sure about the number of elements thats is going to proceed after n then try this method.
    The best solution is the one you find it by yourself
    Attachments:
    String to 2D.vi ‏7 KB

  • Txt to XL to 2D array

    HI
    How can I convert the attach txt file to XL to 2D array. This is laser beam profile data from a CCD camera. Array size 640x480.
    I want to read the third colum (value) only and conver into 2D array to display beam profile
    Thanks
    Attachments:
    Laser beam data.zip ‏968 KB

    Hi,
    I work for a laser company myself and have done something simliar to what you are trying. I have added in some more functionality to the first VI I posted. I wanted to show you the steps that I have gone through to get it into a 3D graph and get the line profile at the peak. I might be mixing my columns and rows up but I am sure you can debug all that.
    All that its left is for you to go away and work out your FWHM, 1/e or 1/e^2 spot size converting pixels to microns.
    @smercurio_fc (Saverio, right?): I was concerned that the multiple space delimiter (8 space representation of a tab is my guess) wasn't constant because of field padding. So thats while I choose the read a line at time method. This was instead of reading in a 10meg file and manipulating it in a loop or using the spreadsheet to array functionality. At the same time I thought I would demonstrate to Kamalm2 that you can use file functions to get your data from the file while keeping the memory consumption down. Of course, you are absolutely right, it is slower. Visumans clocked in a ~3secs and my version was ~7 secs. To me thats not a big deal. I would not have posted the VI if the OP had to run my file and go a away and make a wee cup of tea and come back to it while it was loading.
    Right, its Saturday afternoon and I am off to play Sins of a Solar Empire which I highly recommend.
    Hope this helps you out
    cheers
    David
    Message Edited by David Crawford on 10-31-2009 12:56 PM
    Attachments:
    Read and Plot Laser Beam Data V2.vi ‏137 KB
    Read and Plot Laser Beam Data V2.jpg ‏399 KB

  • Logfile Generation utilizing "Excel" (Creating and Appending Report)

    All,
    As always, thanks for the help you have given me in the past....especially the Vets. I have tried to figure out a solution to my issue from the message board, but no solution seems to fit what I am doing.
    Here is my situation...... I am using Labview to test my product one unit at a time. I have always used Teststand and report generation from there, but this time it is strictly Labview. This is my first attempt to create a logfile with Excel that appends one xls file everytime one unit is tested.
    The way my test is set up now, I test and collect the data in an array for when I created the logfile generation VI. I took several stabs at it, looked at examples, but cant figure out the direction I need to go to create this. Here is the parameteres necessary for the logfile (spreadsheet).
    -All UUT's will go into one spreadsheet and the spreadsheet will be appended by adding new data in next available row.
    -Data is imported to spreadsheet in array format.
    -Test data that passes will be green, test data that fails will be red (I can figure this out, but this is why I need to use Excel)
    -I want to use Excel so I have more flexibility for graphs and things of that nature in the future.
    It seems rather simple, but not for me.....lol. If I go to the Report Generation Toolkit, i  see "Create Report" and "Append Report"....but Append Report still wants the "report input" node wired. What do I wire that to? For example, if I have an excel spreadsheet called hangover.xls, do I somehow wire hangover.xls to the input? I am having trouble finding answers. I would really appreciate a simple JPG or VI so I can understand the setup for what I want to do.
    Comments and links to threads/help appreciated!
    Ryan

    Hi Evan,
    Thanks for the other examples....I thought I was going to be able to manipulate them into what I want, but ended up spending about 6 hours playing with it and up to 2am. I am getting so frustrated with this. This is new ground for me, I never have experimented with logfile creation. I am sorry to keep bothering you with this but I am ready to pull my hair out. I attached a couple Vi's....Spreadsheet import is the main VI and report.vi is the sub.....i need to rename them better but haven't got there.
    First off, that VI you posted that I couldn't open, could you just take a JPG of the block diagram? That would really help.
    I need to create a spreadsheet with logfile data in rows. The spreadsheet is to be appended for each unit under test. Each unit under test gets one row and all data is written at the end of the test. If you look at the spreadsheet_import.vi, I am basically taking a bunch of 1D arrays of data to create one long 1D array for one row.
    Every month a new spreadsheet is created (so log file data is divided into months) , and that is what the report.vi does....it looks to see if the filename is already created and if not, sends a boolean to the write to spreadsheet file to append. I reverted to "write to spreadsheet" because for the life of me, I cannot figure out how to use the worksheet portion to do this. I would think this should be pretty simple, but I cannot figure out and its not for lack of trying.
     If I use "write to spreadsheet", I am going to run into problems because I ultimately want to use a excel template with formulas but if I can figure it out, this will have to do.
    All I really want to do is to create a spreadsheet if one doesnt exist or append if it does, combine all my 1d array data, and create one row with this data. The other issue I ran into before is I cant figure out how to tell Excel where the next row is.......UUGHHHH! This is definitely stressing me out as I have a deadline and I will gladly sent a case of beer to Norway for the help received.
    Dying Here,
    Ryan
    Attachments:
    Spreadsheet_import.vi ‏14 KB
    report.vi ‏33 KB

  • How to plot a graph from text file?

    This is driving me nuts!
    I would like to plot a list of numbers in a text file to a graph. Each munber is on a new line, like this -
    345
    356
    378
    379
    345
    etc.
    I managed to import the file and split it with the 'Spreadsheet to array' function but can't get much further than that.
    Help would be much appriciated.
    Ben H

    You just need to use the Read From Spreadsheet function and wire a 'True' to the transpose input. Wire the 1D array output to a graph.
    Message Edited by Dennis Knutson on 10-20-2006 12:40 PM
    Attachments:
    Read From Spreadsheet.PNG ‏28 KB

  • Temperature input

    Hello,
    I have a VI which takes input from various sources, and writes it to a file.  I have the file include data in its comments section as the data is of the form "header data, header data, sample data", and this is a natural input.  The problem I am having is that some of the data I am trying to input, specifically the temperature, is from a gauge that runs in the background, and when I wire it to the comments, the VI does not execute (in a non-fatal error).  It doesn't even get to the sequence structure.  I think the problem is that the program does not know how to get a single value from a dataset running continuously in the background.
    I have attached the VI.  Specifically, what I am trying to do is wire the bolometer temperature double into the comments of the Write to File VI.  Every time I do this (with proper concatenation and conversion to string, of course), The VI does not run.
    Any help would be greatly appreciated.
    -Mike
    Attachments:
    build10final.llb ‏608 KB

    You may have read some place that LabVIEW is a dataflow language. Let me explain what that means. A section of code (function, structure, whatever) will not execute until the data inputs required are available. With a while loop, if you wire from inside the loop to something outside, the data outside will not be available until the while loop finishes. That means that when you wired the data to the sequence structure, the sequence structure will wait until you click the 'stop 2' button in your VI. There are many ways to avoid this in your case but the easiest may be to simply put a local variable of the temperature indicator inside your sequence structure.
    I question what you are doing with the case statement inside your while loop. First, it's never a good idea to hide code inside by making the structure smaller. Second, it would seem that you are parsing comma separated data with a whole lot of unneccessary code. If it truly is comma separated, you can do everything with the Spreadsheet String to Array and an Index Array function. You can specify a comma as a separator for Spreadsheet to Array and it will convert it to an array of DBLs. Use index array to get the element(s) you want.

  • Plot each collum as a graph

    Hello...
    I have a simple problem, but I am not able to solve it.
    I have a ascii file with 10 columns and 50 lines each column. I need to load this file and plot each column as a individual graph.
    My idea: Read from spreadsheet -> Index Array -> Array to Cluster (cluster size=10) -> Unbundle -> wire each graph to each cluster
    Did not work!!! Where is the problem?
    A second way to do this is: after load the ascii file, transpose the data, converting each column in one row, and apply many Array subset and wire each graph to each array subset. But I am avoiding this because this way I will need to create 10 array subset.
    Thanks
    Daniel

    daniel.penteado a écrit:
    Hello...
    I have a simple problem, but I am not able to solve it.
    I have a ascii file with 10 columns and 50 lines each column. I need to load this file and plot each column as a individual graph.
    My idea: Read from spreadsheet -> Index Array -> Array to Cluster (cluster size=10) -> Unbundle -> wire each graph to each cluster
    Did not work!!! Where is the problem?
    A second way to do this is: after load the ascii file, transpose the data, converting each column in one row, and apply many Array subset and wire each graph to each array subset. But I am avoiding this because this way I will need to create 10 array subset.
    Thanks
    Daniel
    If you intend to have 10 different graph indicators on your panel, then you just have to use an index array function, expand it to create 10 outputs (I bet you missed that property... ), then wire each output to each graph. Of course, don't forget to wire also the first column input with a zero value, to tell LV you want to extract the colum data.
    You could also have a single graph indicator showing all the 10 curves. Since your data are organized as colums, transpose the 2D array first, then wire it directly to the graph.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How can I convert these 250 data points in a spreadsheet file into an array???!!!

    I want to convert these points(see spreadsheet file attached) into a 1-D array of numbers and plot them using a vi. I am using the readfromspreadsheet.vi and it just gives me a number 4 and plots that. Please tell me what to do...I'm confused and have a project due!!!
    Attachments:
    ec1.xls ‏14 KB
    test.vi ‏14 KB

    Save the excel spreadsheet as tab delimited text file and use "Read From Spreadsheet File" vi to read it.

  • How can I convert 400 data points from a spreadsheet file to an array?

    The spreadsheet file contains over 5000 data points (in one column) of which I only want the first 400 and want to convert them to an array in Labview. I tried to use the 'readfromspreadsheet' vi but it wasn't much help. Please tell me how i should approach this problem and what vi's to use.

    I attach a model vi that you can experiment with. You will need to know the formatting of the data in your file, from there -plus the delimiter- you'll be able to estimate how many characters makes the first 400 data point. It's possible to develop a more robust vi to do this, in the mean time, the attached vi can quickly give some answer.
    Attachments:
    model.vi ‏28 KB

  • Array to spreadsheet string - remove space after delimiter

    Hi
    I created a Labview program to acquire a electrical signal and send it using TCP/IP.
    The image in attachment shows a piece of my code. The AQ subVI was created by me to accomplish the acquisition.
    However, the string that the "array to spreadsheet string" VI returns is something like this:
    -0.800781^ -1.030273^ -1.098633^ -0.942383^ -0.644531^ -0.209961^ 0.258789^ 0.712891^
    The VI is using the ^ character as a delimiter and it is converting commas to points as decimal separators.
    Now, what i would like to do is to remove the space character between the ^ character and the sample value, simply because that is what the receiver of the TCP/IP message wants.
    Can anybody help me?
    Thanks in advance
    Attachments:
    Array to spreadsheet.png ‏7 KB

    hi there
    remove the space between the ";" and "%" in your format specifier.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

Maybe you are looking for

  • Can't rename object

    Hi every body, Now i have one problem about Premiere Pro CS4 would like to support from everyone. Normally, all object is contented in Left side of Premiere and can rename only one click to object (for example click to Bin 03) but i couldn't rename t

  • How do you make different versions of a Project?

    I want to take a project and save out a different variation of it. But when I duplicate my project I wind up with a huge new project file on my hard drive with duplicate rendering files etc. Isn't there a way to make multiple versions of a project fi

  • B2B-50029:  B2B runtime error: oracle.xml.parser.v2.XMLParseException: Start of root element expected.

    Dear All, I am a beginner to Oracle B2B. I have created an agreement to Recieve 852, Product Activity data(POS) from one of the Trading partner. This is an inbound process. A  SOA composite application is created to Recieve the data and insert into p

  • ABAP calculating in Include MV45AFZZ

    Hej. I am experiencing strange things with this bit of code.  This code is taking place in FORM userexit_save_document_prepare in include MV45AFZZ. And the result of the calculation is wrong, when I take the code and try it out in a new program, then

  • Interface's parent

    how can an interface has a parent? the parent i want is an abstract class. thanks