Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello everyone,
in the attached file below, fourth column of matrix I is d1 values.
I want to loop through each d1 values and get R as a matrix.
could someone help me here
attached mathcad 10 file.
Solved! Go to Solution.
I think you want d1 to be the 5th column of matrix I, the one with index 4 (because counting starts at 0).
Well, here goes:
And read my extended first answer...
Success!
Luc
If you just want the 4th column values of the matrix I, then you can do that using the column operator:
Look in the operators panel for the column operator, or type [Ctrl-c] after the I.
Note that (by default) matrix indexing starts at 0, so the fourth column has index 3.
If you want the function V(d1) applied to that result, then do:
Note that you have to vectorise the expression (the arrow above V(I<3>)). The vectorise operator is also found on the operators panel. Its shortcut is [Ctrl-Shft-^].
Your function R doesn't do what you might think:
it assigns 0 to i, then loops assigning sequentially, each of the values of the matrix I to VED.
Then within the loop, you assign the full matrix to a row vector with those four variable names.
This means that x gets the value 0 m, Ast gets the value 0 cm2, ...., d1 gets the value 0 cm and n1 gets the value 0.
Note that these (very same!) values are assigned 30 times, because I has 30 elements.
Next thing in the loop is that you re-assign V(d1) to VED, overwriting the initial value of VED.
Now d1 is 0 cm (every time !), and through the function V() that results in 10 mm = 1 cm.
Last thing in the loop is you increase i with 1 (for no use, because you never use its value).
After the loop you return VED.
Well, that's 10 mm = 1 cm,
Success!
Luc
i think you understood it wrong
i want R values as matrix, which depends on fourth column of Matrix I.
Hi,
What should that matrix R look like, then?
What do i do, if i want to use two parameter from I.
example i want to use the values of fourth and fifth column of I( which are d1 and n1 respectively).
I think you want d1 to be the 5th column of matrix I, the one with index 4 (because counting starts at 0).
Well, here goes:
And read my extended first answer...
Success!
Luc