# MATLAB: Objects in a common figure

figurefunctionif statementobjectrobot modelling

This is to long of a code to post here but it's downloadable above. What i have is a function with data struct {rd} describing the links, each links jogging limits, tools structur/tcp, and more. From this i use a function to beable to call on a function to draw the links, call another function to draw the frames and another function to do the rotation and translation. Basicly this is alot of functions within a function. the struct variables are:
``function rd = robotdatawtool(id)% switching depending on the idrd.name = 'somename'rd.jang = % starting angles of the jointsrd.joff = % translation in zrd.range = % translation in xrd.twist = % rotation in x for next linkrd.jvar = % whether it's 'r'(rotation) 'p'(prismatic)rd.jvarlimit = % angular limits or each joint or vector for prismsrd.xyz = % tool basicly just vectors with line([...])rd.A = %rotational and translational data for the tcp``
this then goes to the construction function that has the functions within a function setup
``function showrobotu(rd)%% Defining the variables in structif rd.name == 'IRB1600mig' % the name in the struct    phase = 'migweldpos';    pos1 = [1;0]; % where it's supposed to start at [x;y]elseif rd.name == 'IRB1600tig' % the name in the struct    phase = 'tigweldpos';    pos2 = [-1;0]; % where it's supposed to start at [x;y]elseif rd.name == 'scarajobber' % the name in the struct    phase = 'orderpos';    pos3 = [0;1]; % where it's supposed to start at [x;y]end% then switch depending on the phase``
I've managed to make 2 robots show up on the same figure but the third just won't show now it just says :
Matrix dimensions must agree.
Error in thisisarobotjob>showrobotu (line 80)
if rd.name == 'IRB1600mig'
Error in thisisarobotjob (line 14)
showrobotu(rd2)
So the problem seems to be the if statement but I've checked countless times and the name of rd2 is the same as stated in the struct. I don't know what to do at this point maby i've been working to long on this and don't see something obvious but maby anyone spots the error I'm not seeing.
What i want is simply to be able to make all three robots included in the robotdatawtool to showup so i can start coding the trajectorys. I have an Idea in my head on how to be able to make them do seperate tasks at one however that's still just very losely formulated but i figured I'd need to be able to make three of them apear first.
this is the one missing and it's the only one that doesn't look like the other's but i don't see how that would be a problem.

``rd.name == 'IRB1600mig'``
``strcmp(rd.name, 'IRB1600mig')``