Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#2824 closed Bug (Fixed)

_ArrayExtract bugged + solution

Reported by: Quirinus Owned by:
Milestone: Component: Standard UDFs
Version: Severity: None
Keywords: UDF, Array, _ArrayExtract, Bug, Solution Cc:


The problem is the same as here, but with _ArrayExtract instead:

$height = 10
$width = 6
Local $aArray[$width][$height]
For $i = 0 To $width-1
    For $j = 0 To $height-1
        $aArray[$i][$j] = "(" & $i & "," & $j & ")"
_ArrayDisplay($aArray, "Original")

$column = 0
_ArrayDisplay(_ArrayExtract($aArray, 0, $width-1, $column, $column), "Extracted")

Seems like Melba23 found the solution in that thread. He didn't post it, but I think it's just removing this line:

If $iEnd_Col = 0 Then $iEnd_Col = $iDim_2

from Array.au3 UDF file in the _ArrayExtract function under Case 2 (for me that's the line 951). I'm not sure if this messes up something else, though, so it should be tested and carefully thought about.

Also, the documentation is wrong. The whole Return Values and Remarks section for this function are suspect (someone probably copy-pasted from another function then forgot to change). The return value on success is actually the extracted array, not 1.

Thank you.

Attachments (0)

Change History (6)

comment:1 in reply to: ↑ description Changed 10 years ago by Quirinus

Sorry, I forgot to mention what's the problem and solution.

The problem is that _ArrayExtract extracts all columns if you put start and end column number 0, but it should just extract the 0-th column instead. If you use any other start/end column setup, it works (except the ones that produce errors, obviously).

comment:2 Changed 10 years ago by Quirinus

Ok, I noticed it doesn't work for rows as well, so in addition to removing the line above, you need to remove this line as well:

If $iEnd_Row = 0 Then $iEnd_Row = $iDim_1

comment:3 Changed 10 years ago by Quirinus

The same problem might be in other functions in Array.au3, so it might be wise to check them all, preventively.

comment:4 Changed 10 years ago by Melba23

I have posted a solution in your forum thread - please check it.


comment:5 Changed 10 years ago by Melba23

  • Resolution set to Fixed
  • Status changed from new to closed



comment:6 Changed 8 years ago by anonymous

I would like to add that this problem is still not resolved:
The return value on success is actually the extracted array, not 1.
The helpfile still contains "return value = 1" for _ArrayExtract, which is wrong.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.