How can I resize an array of strings?

I'm having a problem of not being able to use the CIN functions and therefore can't use the convenient resizing methods. I have tried to use NumericArrayResize to resize an array of strings, but it's not working correctly. Here's what I've tried most recently. I have tried many variations, so if you want to modify what I have posted, or just provide new code, please feel free.
typedef struct {
int32 dimSize;
LStrHandle elt[1];
} LStrHandleArray;
typedef LStrHandleArray **LStrHandleArrayHandle;
void someMethod(LStrHandleArrayHandle arrayOut) {
// attempting to write the string "asdf" in the first element in the array. (1D array)
int newSize = 1;
MgErr e = NumericArrayResize(uL, 1L, (UHandle*)&arr
ayOut, newSize);
(*arrayOut)->dimSize = newSize;
LStrHandle hdl = *(*arrayOut)->elt;
long str_size = strlen("asdf");
MgErr err = NumericArrayResize(uB, 1L,(UHandle *)&hdl, str_size);
LStrLen(*hdl) = str_size;
MoveBlock("asdf", LStrBuf(*hdl), str_size);
The code above doesn't result in crashing labview at any time. The string "asdf" is not copied though. And, after being able to copy one string I would like to extend this to many elements in a 1D array of strings.
Thanks!
Naveen

LabVIEW stores string arrays as an array of handles to those strings. To resize an array of strings you need to declare a new string in LabVIEW's data space, resize the handle array, and add a handle to your new string. Here is an example program which does this.
-Aaron Marks
National Instruments
Attachments:
resize.zip ‏252 KB

Similar Messages

  • How do I resize an array of strings in a CIN ?

    I've been using a call to NumericArrayResize() to allocate enough memory for numeric arrays, but I now have an array of strings that I need to build in a DLL/CIN and pass back to Labview. Can someone point me to a snippet that will demonstrate how to populate an array of strings with data?
    Kindest,
    Warren

    Check the follwing example. It may be what you want:
    Using a CIN to Create an Array of Strings in LabVIEW
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&AD517F5DCCAF70228625683A000A570F&cat=2F4F574886553A62862567AC004F032D
    Also, check the following example, as it provide an example on how to handle strings.
    Code Interface Node (CIN) That Converts a LabVIEW String to a C String, Modifies it, and Returns it as a LabVIEW String
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&D978409908EA760D8625683A000B6B6E&cat=2F4F574886553A62862567AC004F032D
    Regards;
    EV
    www.vartortech.com

  • How can i combine an array of string and an array of integers ?

    i have an array of string data [to be used as header], and an array of multiple column integer vakues;i need them together in one file. 
    Am not able to combine them so that i can write them into a single file.
    Solved!
    Go to Solution.
    Attachments:
    string file input.txt ‏1 KB
    Test build_1.vi ‏13 KB

    There are a few ways you can do this.  What I recommend is:
    Open the file
    Use the Array to Spreadsheet String to turn your headers into a single string
    Write this to the file.
    Use the Array to Spreadsheet String to turn your numeric data into a single string
    Write this to the file.
    Close the file
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I resize an array directly (without using reshape array)?

    Hi everyone,
    I have a porgam in which I am using an array as a command (with specific values that the user enters before running the program). By mistake, at the beginning I created a 4 dimension array (for instance), but I didn't know because I was only showing the first 3 values (not expanding the array to 4 or more). I would now like to change the size of the array from 4 to 3. I don't seem to be able to find an option (right clicking on the array) that enables me to do this directly. I don't want to use the "reshape array" icon, because this is not what I want to do. I hope I am clear enough.
    Thanks for any help,
    regards,
    Marc
    Solved!
    Go to Solution.
    Attachments:
    Forum array.vi ‏7 KB

    HI,
              If i have understood your question hope this helps you. If you want to change the size of the array right click on the array element and click Data Operations>Delete Element or if you want to do programmatically delete the particular element.
    Attachments:
    Forum%20array[1].vi ‏11 KB

  • How can I convert an array off byte into an Object ?

    Hi folks...
    I�m developing an application that comunicates a PDA and a computer via Wi-Fi. I�m using a DataStream ( Input and Output ) to receive / send information from / to the computer. Most off the data received from him is in the byte[] type...
    How can I convert an array off byte ( byte[] ) into an Object using MIDP 2.0 / CLDC 1.1 ?
    I found on the web 2 functions that made this... but it uses a ObjectOutputStream and ObjectInputStream classes that is not provided by the J2ME plataform...
    How can I do this ?
    Waiting answers
    Rodrigo Kerkhoff

    There are no ObjectOutputStream and ObjectInputStream classes in CLDC. You must know what you are writing to and reading from the DataStream. You should write the primitives like int, String to the DataOutputstream at one end and read those in exactly the same sequence at the outher end using readInt(), readUTF() methods.

  • How can to resize an image uploaded in to the smart image

    Hi
        I have an image uploaded into the smartimage from the local file system. How can i resize this file or create a rendition for this image?
    Thanks
    Veena

    Hi
       I got a reference for the same question from Stack Overflow http://stackoverflow.com/questions/14726485/resize-an-image-resource-in-cq5/16728970#16728 970
    I tried the same method
    Resource resourceNew = resource.getResourceResolver().getResource(img.getFileReference());
        Asset asset = resourceNew.adaptTo(Asset.class);
        log.error("asset ****" + asset);
        Layer layer = new Layer(asset.getOriginal().getStream());
        layer.resize(200, 200);
        log.error("layer ****" + layer);
                            Image image = new Image(resource);
        String mimeType = image.getMimeType();
        ByteArrayOutputStream bout = null;
        ByteArrayInputStream bin = null;
        try {
            bout = new ByteArrayOutputStream(2048);
            layer.write(mimeType, 1, bout);
            bin = new ByteArrayInputStream(bout.toByteArray());
            asset.addRendition("resizedImage", bin, mimeType);
    log.error("asset Bin" + asset);
        } finally {
            // close streams ...              
    Where img is my Image object and I was able to create a rendition in the dam.
    But the rendition I am getting is in File format. Is there a way by which i can change it to png format??? any Help will be appreciable..
    Thanks
    Veena

  • How can I resize a JFrame ,to fit into the screen size

    I have a Jframe which has JPanel and JPanel contains lot of other components.JPanel size is 980,1400. when i use JFrame.show method jpanel goes beyond the screen size in length and I am not able to see the portion below the screen.How can I resize the JFrame so that JFrame and JPanel shrinks to fit into the screen size.I need this because I have a PRINT button at bottom of the JPanel.Thanks.

    Thank you for your reply.I tried with the following code as you have told.But the frame is still going beyond the screen.Can you please look into it and tell me whats wrong ?
    //public class PlayerRegForm extends javax.swing.JFrame implements Printable
    public static void main(String args[]) {
    PlayerRegForm prf = new PlayerRegForm();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = prf.getSize();
    if (frameSize.height > screenSize.height)
    frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
    frameSize.width = screenSize.width;
    System.out.println("Screen Size ----------------- " + screenSize);
    System.out.println(" Frame Size ----------------- " + frameSize);
    prf.setSize(frameSize.width, frameSize.height);
    prf.pack();
    prf.show();
    =============================================================================
    Screen Size ----------------- java.awt.Dimension[width=1024,height=768]
    Frame Size ----------------- java.awt.Dimension[width=112,height=28]

  • How can i get a array from a JSP ?

    Hi all,
    i have a STORED PROCEDURE like this:
    static public void getMyArray(double [] xx) {
    for (int i=0; i<myarr.length;i++){
    myarr=3.145*i;
    xx=myarr;
    return ;
    how can i get the array with XSQL and transform with a XSL ?
    Is this at all possible?
    Thanks for any help.
    Achim

    u r asking how ca u get array from jsp?
    and u r asking xsql ...some stuff i couldnot understand .can u repeat the question properly?
    null

  • How can I use my array in another method.... Or better yet, what's wrong?

    I guess I'll show you what I am trying to do rather and then explain it
    public class arraycalc
    int[] dog;
    public void arraycalc()
    dog = new int[2];
    public void setSize(int size)
    dog[1] = size;
    public int getSize()
    return dog[1];
    This gives me a null pointer exception...
    How can I use my array from other methods?

    You have to make the array static. :)
    Although I must admit, this is rather bad usage. What you want to do is use an object constructor to make this class an object type, and then create the array in your main class using this type, and then call the methods from this class to modify your array. Creating the array inside the other method leads to a whole bunch of other stuff that's ... well, bad. :)
    Another thing: Because you're creating your array inside this class and you want to call your array from another class, you need to make the array static; to make it static, you must make your methods static. And according to my most ingenious computer science teacher, STATIC METHODS SUCK. :D
    So, if you want to stick with your layout, it would look like:
    public class arraycalc
         static int[] dog;
         public static void arraycalc()
              dog = new int[2];
         public static void setSize(int size)
              dog[1] = size;
         public static int getSize()
              return dog[1];
    }But I must warn you, that is absolutely horrible code, and you shouldn't use it. In fact, I don't even know why I posted it.
    You should definitely read up on OOP, as this problem would be better solved by creating a new object type.

  • How can I resize a photo in iPhoto without cropping it?

    I am taking pictures on my iphone 4s and using iphoto to edit them on macbook pro.  I need to upload these photos at a size much smaller than what i am able to take with my phone.  The only way I see to adjust the size of a photo in iphoto is to crop it.  How can I resize without cropping?
    Thank you

    It's an option in the Export menu.
    File -> Export and under the Size option you can choose the maximum you prefer. Export that and upload from the desktop.

  • How can I create a array with all files from a directory

    How can I create a array of files or varchar with all files from a directory?

    I thought the example could be improved upon. I've posted a solution on my blog that doesn't require writing the directory list to a table. It simply returns it as a nested table of files as a SQL datatype. You can find it here:
    http://maclochlainn.wordpress.com/2008/06/05/how-you-can-read-an-external-directory-list-from-sql/

  • How can I resize partition? - New larger hard drive installed

    Hello,
    The hard drive on my MacBook Pro recently died on me (just past my Apple Care warranty - lucky me).  I sent it to an authorised reseller/repair place and they installed a new hard drive for me - replacing my old 250GB with a nice new 500GB.  The problem is when they copied over the disk image from my previous hard drive they did not scale up the image (yeah, not so happy bout that).  Now I find myself with a 500GB hard drive with a 250GB partition called Macintosh HD and 250GB of unused/unusable space.  On top of that I'm just starting to get messages saying boot disk nearly full.  How can I resize the "Macintosh HD" partition to use the entire disk?  I've tried using disk utility, clicking on the main drive, going to the partition tab and dragging the Macintosh HD partition to use the entire disk but after a few seconds of a message saying "waiting for disk to reappear" it returns to the same 250GB size.  Running OSX 10.9.3.  Any suggestions?
    Thanks all!

    See the tips in pounding's section on using Disk Utility:http://pondini.org/OSX/Home.html and you could also take the route of buying an external hard drive (a great idea of maintaining a backup), format that drive for Mac OS X Extended (Journaled), clone the startup disk to that drive, then boot from the external, erase and format the internal, then clone the external back to the internal partitioned as you want.

  • How can I resize a pdf page content with annotations and highlights in Acrobat Pro?

    How can I resize a pdf page content with annotations and highlights in Acrobat Pro while maintaining page size and annotation/highlight interactivity? I've tried to use the crop tool in Acrobat Pro (9) and the page does resize, but the highlights and annotations go all over the place. I specifically need to scale the page content smaller (83%) but maintain page size and annotation/highlight to content connection and interactivity.

    An old trick (not recommended) would be to print to a new PDF with the page size selected but a scaling of the content. Only print the document, not the markup, to a new PDF. Close that PDF when done and reopen the old one (or maybe a copy of the old one for safety) and use Document Replace pages and select the new document to replace your current pages. You will then have to go back through the markup to locate it all correctly. There may be a more elegant way, but this may be the fastest.

  • When I open a file in Photoshop CS4, how can I resize My Open Window File?it is stuck on full screen

    When I Open a File in Photoshop CS4, How can I Resize My Open Window File? It is stuck on Full Screen?

    Which operating system are you using?
    On a windows os, usually one can just double click on the title bar in the open dialog.

  • I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?

    I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?

    In the Editor, use File...Process Multiple Files.  See the Help for more info.
    Ken

Maybe you are looking for

  • Old computer to new...

    If I back up my ipod music and reformat my ipod from pc to mac, can I import my playlist or do I have to start all over? What about the music purchased from itunes? I am sure I can find all this in some manual, I just have not gotten around to it yet

  • PSE 2 not working in Windows 7 (was My)

    My Adobe photoshop elements 2.0 does not work and i can not update it on my Windows 7

  • 2009 iMac is running slowly after installing Yosemite

    Dear Community - I recently "upgraded" my OS to Yosemite ... unfortunately I had not gone to Mavericks in the meantime, so there's no way for me to re-install it. Any suggestions for how to rescue my iMac from being a brick? EtreCheck report is below

  • Trouble signing in with Mail

    I've just setup a new OS X server (10.5.6). The only two services I have running are mail and web. The web services seem to be running well. However, mail is giving me problems. Specifically: If I send mail to a user of my machine (me) from gmail, fo

  • Where are ecm_sel parameters applied in CS_BOM_EXPL_MAT_V2  ????

    If you run RCS11001 deirectly or from CS11, then if your matnr has kzeff "on" in mara, SAP will pop the "parameter effectivity" panel to allow you to enter effectivity parameters as a fillter on the BOM explosion. This panel is popped by the function