Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert a String to 2D array and Operate their values

Status
Not open for further replies.

jtm2020hyo

Technical User
Dec 30, 2021
24
0
0
PE
Convert String to Array then do basic operations:

StringSource= (A1,B2,C1; A2,B2,C1; A3,B2,C2; A4,B2,C2;A5,B2,C3; A6,B2,C4; A7,B2,C5;)

to

2DArray = {A1,B1,C1; A2,B2,C2; A3,B3,C3; A4,B4,C4 ; A5,B5,C5; A6,B6,C6; A7,B7,C7}

using Split "," For Axis-X and ";" for Axis-Y and not sure that more do.

how can I do arithmetic operations 2DArray like this :

((2DArray(0)(0)*2DArray(0)(1))/2DArray(0)(2))+((2DArray(1)(0)*2DArray(1)(1))/2DArray(1)(2))+ ((2DArray(3)(0)*2DArray(3)(1))/2DArray(3)(2))+ ... etc

where:
if 2DArray(X)(2) is blank = "1"
if 2DArray(X)(1) is blank = "1"
if 2DArray(X)(0) is blank = "0"

RESULT = (A1 * B1 / C1) + ...

 
Hi jtm2020hyo,

You can store your string components in 2D-array which elements are addressed as A(i,j) or you can store them in 1D-array of 1D-arrays which elements are addressed as B(i)(j)
Both arrays A and B seems to be similar, but working with them is a little bit different: addressing their elements as A(i)(j) or B(i, j) does not work.

If the array elements are numbers, then the arithmetic like A(i,j)*A(m,n) or B(i)(j)*B(m)(n) works. However in your case the array elements are strings and therefore the arithmetic operations cannot work.
 

jtm2020hyo, if I misunderstood your question and you need something completely different, don't hesitate to ask
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top