Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello everybody,
I need some help to select sevral lign in a matrix using a logical test and then create a vector which wwould summarize all selected items.
To be more accurate, my problem is to select the right "spring" cosidering given deflexion and maximum reaction load within this loading configuration. I already creat a fonction which calculat the reaction load for a given deflexion and spring model ( equ_paulstra_reactionload("matrix of the approximated polynomial coeficient which give reaction load in function of the deflexion","deflexion","ligne of the considered model" ). Then I would create a fonction which test each spring and put them in a vector using there reference.
I join my work done so far.
Thanks a lot for your elp,
regards,
Mathieu STAUCH
Solved! Go to Solution.
Have a look if the attached is of any help.
I have added units to max_spring_reaction - you might want to change them
Mike
You haven't defined Reaction_Spring.
Mike
My mistake,
Reaction_Spring is defined at the beginnig as max_spring_reaction. (I modified it but Im not able to send it on my response, sorry)
Mat
Have a look if the attached is of any help.
I have added units to max_spring_reaction - you might want to change them
Mike
Thak you very much!
one last think, could it be possible to simply remove all zero from that vector and then obtain a clear vector which summarize the possible spring?
Thanks a lot one more time,
Mat
Would the attached file help?
Only values which pass the condition are collected in the output vector. With your test data there is no difference seen as all values pass.
As Werner has shown, just remove the zero otherwise statement.
Mike
Mike Armstrong wrote:
As Werner has shown, just remove the zero otherwise statement.
Mike
Just removing the otherwise statement would still put the zeros in the resulting vector.
Oh, you also snuck the rows(P) feature in. I must pay more attention
Mike
cleaned up two programming errors.
Nothing attached Fred.
Mike