Jump to content

Recommended Posts

Posted

Is there a "best" way for getting my data to start in row 0 in an array?  I have been using the attached code. What, if any, would be a short or quicker way to achieve my objective to only have data in the rows?  Is Redim so yesterday or resource hogging?

Thanks.

Hobbyist

Local $izero = 0, $sTemp

For $i = 0 To UBound( $aLogBUD2, 1) - 1
    $iDelete = 0

    For $j = 0 To UBound( $aLogBUD2, 2) - 1
        $aLogBUD2[ $izero][$j] =  $aLogBUD2[$i][$j]
        ;If  $aLogBUD2[$i][$j] == 0  Then $iDelete = 1  ; commented out until I think about need for it
        If   $aLogBUD2[$i][0] = "" Then $iDelete = 1

    Next
    If NOT $iDelete  Then  $izero += 1
Next

Redim  $aLogBUD2[ $izero][UBound( $aLogBUD2, 2) ]
Posted

I'm not clear on what it is you're asking for. Are you just looking to delete lines if the first column is empty?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

Im also a little confused, but i *THINK* he means he doesnt want the array count "[0]" but instead, have his first column start at "[0]"

As far as i can see, its only used with _FileReadToArray (and other such types) with the flag

$FRTA_NOCOUNT (0)
Edited by t1ck3ts
Posted

Yeh I think my fingers were typing different than my thoughts. Sorry.

I have read the help files (always my starting point).

I can successfully read a file (csv) into an array - no problem there.

Followed some examples using Unbound and I think that is where my problem starts.

I always get my data starting in row 1 and not in row 0.  

So i went to deleting blank(s) with the above code.  I think if I was using the Unbound properly I wouldn't have to delete the row 0 in the first place.

Thanks

Posted

Use _ArrayDelete and delete the first element of the array (0).

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...