hot202 Posted December 12, 2010 Posted December 12, 2010 Hi i cant work this out. Im sure its something really easy that im missing. If i have a array like this how do i edit row2 two ["05","e3","68","hh","04","50","02"] $Arr2d[4][7] = [["01","00","00","00","04","00","01"], _ ; [1] ["02","00","00","00","04","00","02"], _ ; [2] ["03","00","00","00","04","00","03"], _ ; [3] ["04","00","00","00","04","00","04"]]; [4] Thanks guys
funkey Posted December 12, 2010 Posted December 12, 2010 #include <Array.au3> Local $Arr2d[4][7] = [["01", "00", "00", "00", "04", "00", "01"], _ ; [0] ["02", "00", "00", "00", "04", "00", "02"], _ ; [1] ["03", "00", "00", "00", "04", "00", "03"], _ ; [2] ["04", "00", "00", "00", "04", "00", "04"]]; [3] Local $temp[7] = ["05", "e3", "68", "hh", "04", "50", "02"] For $i = 0 To 6 $Arr2d[1][$i] = $temp[$i] Next _ArrayDisplay($Arr2d) Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
hot202 Posted December 12, 2010 Author Posted December 12, 2010 (edited) thankyou Edit: i tryed to make it into a Func but it dont seem to work. #include <Array.au3> local $Arr2d[4][7] = [["01", "00", "00", "00", "04", "00", "01"], _ ; [0] ["02", "00", "00", "00", "04", "00", "02"], _ ; [1] ["03", "00", "00", "00", "04", "00", "03"], _ ; [2] ["04", "00", "00", "00", "04", "00", "04"]]; [3] _ArrayDisplay($Arr2d) _2DArrayEdit($Arr2d,"1","05","e3","68","hh","04","50","02") Func _2DArrayEdit($aArray,$aLine,$1,$2,$3,$4,$5,$6,$7) local $temp[7] = [$1,$2,$3,$4,$5,$6,$7] For $i = 0 To 6 $aArray[$aLine][$i] = $temp[$i] Next Return $aArray EndFunc _ArrayDisplay($Arr2d) Edited December 12, 2010 by hot202
iamtheky Posted December 12, 2010 Posted December 12, 2010 you are returning a new array #include <Array.au3> local $Arr2d[4][7] = [["01", "00", "00", "00", "04", "00", "01"], _ ; [0] ["02", "00", "00", "00", "04", "00", "02"], _ ; [1] ["03", "00", "00", "00", "04", "00", "03"], _ ; [2] ["04", "00", "00", "00", "04", "00", "04"]]; [3] _ArrayDisplay($Arr2d) $Arr2d = _2DArrayEdit($Arr2d,"1","05","e3","68","hh","04","50","02") Func _2DArrayEdit($aArray,$aLine,$1,$2,$3,$4,$5,$6,$7) local $temp[7] = [$1,$2,$3,$4,$5,$6,$7] For $i = 0 To 6 $aArray[$aLine][$i] = $temp[$i] Next Return $aArray EndFunc _ArrayDisplay($Arr2d) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
funkey Posted December 12, 2010 Posted December 12, 2010 Or you do it ByRef: #include <Array.au3> Local $Arr2d[4][7] = [["01", "00", "00", "00", "04", "00", "01"], _ ; [0] ["02", "00", "00", "00", "04", "00", "02"], _ ; [1] ["03", "00", "00", "00", "04", "00", "03"], _ ; [2] ["04", "00", "00", "00", "04", "00", "04"]]; [3] _ArrayDisplay($Arr2d) _2DArrayEdit($Arr2d, "1", "05", "e3", "68", "hh", "04", "50", "02") _ArrayDisplay($Arr2d) Func _2DArrayEdit(ByRef $aArray, $aLine, $1, $2, $3, $4, $5, $6, $7) Local $temp[7] = [$1, $2, $3, $4, $5, $6, $7] For $i = 0 To 6 $aArray[$aLine][$i] = $temp[$i] Next EndFunc ;==>_2DArrayEdit Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now