Jump to content
Sign in to follow this  
haveahapyday

[noob vex] how to access single component of matrix3?

Recommended Posts

correct me if i shouldn't be doing things this way, but basically in a wrangle sop rather than creating a bunch of separate control channels, i want to make one matrix3 and then access the individual components.

here's a couple ways i've tried:

matrix3 testMatrix = ch3("testMatrix");

f@testValA = testMatrix[0][0];
f@testValB = getcomp(testMatrix, 0, 0);
f@testValC = testMatrix[0:0];

i apologize if this is beyond n00b, but i've tried over an hour to figure this out and got no where.

thanks!

Edited by haveahapyday
fixed code example

Share this post


Link to post
Share on other sites

well your matrix is called testMatrix but you ask for indices or getcomp() of something called limits

getcomp() works just fine and from the docs "The square-brackets operator also works on vectors. You can use it with matrices as well using a pair of brackets: float a = m3[0][1];" (couldnt make it work in 16.5, maybe new feature in 17)

Edited by 3dome

Share this post


Link to post
Share on other sites
7 hours ago, 3dome said:

well your matrix is called testMatrix but you ask for indices or getcomp() of something called limits

whoops, was confusing the example i wrote up with what i was actually using. edited the original post to make the example accurate.

7 hours ago, 3dome said:

getcomp() works just fine and from the docs "The square-brackets operator also works on vectors. You can use it with matrices as well using a pair of brackets: float a = m3[0][1];" (couldnt make it work in 16.5, maybe new feature in 17)

i was using H16 at home when i was trying that so maybe that could be the issue? getcomp() works in V17, but float testValA = testMatrix[0][0]; throws this error:

"Call to undefined array index operator 'matrix3[int]', returning one of vector4, vector2, vector, float[], int[], vector4[] or vector[]."

Share this post


Link to post
Share on other sites

getcomp() should work in H16 too. Don't have it anymore so I can't test. Yes, I get that error in 16.5 too. Submit a RFE if you want.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×