The post Array manipulation appeared first on IT Answers.

]]>for e.g., i have given a small sample of 2×2 matrix and below is the description regarding what manipulation i want to do.

say for e.g my matrix is

0.76 1

0 0.3

now what i want to do is that, whenever the value in the matrix is greater than 0.25, i want to print 1 and if it is less than 0.25 than i want to print 0 and if it is 0 or 1 then let it be as it is….

so the answer for my above matrix should be

1 1

0 0

The post Array manipulation appeared first on IT Answers.

]]>The post Defining a diagonal matrix in VB 6 appeared first on IT Answers.

]]>I am having trouble defining a diagonal matrix.

I am using code that is something like

public diagmatrix(numofm, numofm) as long

(numofm has been pre-set as some number)

but i’m getting an error message, “constant expression required”. Thing is, to begin with, the number of columns and rows (square matrix) should be equal to “numofm”; this is because “numofm” will change on different occassions as selected by users and the code ” public diagmatrix(numofm, numofm) as long” was meant to allow the matrix dimensions to change accordingly.

Secondly, the diagonal elements are dependent on other variables, say, 3 variables, temperature, pressure and thrust. This would thus require a 3by3 diagonal matrix. How would I define these diagonal elements ? Say, Row1, column 1 should be reciprocal of temp.

Row2, column 2 should be reciprocal of pressure

Row3, column 3 should be reciprocal of thrust

Every other element would ofcoure be zero, being a diagonal matrix.

Temp, pressure and thrust are variables and users can add to these, thus requiring a larger matrix—or reduce these variables, thus requiring a smaller matrix.

Thanks.

The post Defining a diagonal matrix in VB 6 appeared first on IT Answers.

]]>