“Dimensions of arrays being concatenated are not consistent”
    1 view (last 30 days)
  
       Show older comments
    
I am getting said error even thoug I don't think I am not concatenating any array.
wallCordsReal = [];
    homoVecSen = [sonars(1); 0; 0; 1];
    poser = gtposes(1,:);
    transMatrix = Tsonar2univ(poser);
    tempWall = transMatrix * homoVecSen;

And here is the function Tsonar2univ:
    function transfMatrix = Tsonar2univ(poser)
    global measured_offsx;
    global measured_offsy;
    global measured_offsphi;
    %sonar origin relative to robot
    RorgS = [measured_offsx; measured_offsy; 0];
    UorgR = [poser(1); poser(2); 0];
    RrS = [cos(measured_offsphi), sin(measured_offsphi), 0; -sin(measured_offsphi), cos(measured_offsphi), 0; 0, 0, 1]
    UrR = [cos(poser(3)), -sin(poser(3)), 0; sin(poser(3)), cos(poser(3)), 0; 0, 0, 1];
    RtS = zeros(4,4);   
    RtS(1:3, 1:3) = RrS;
    RtS(1:3, 4) = RorgS;
    UtR = zeros(4,4);   
    UtR(1:3, 1:3) = UrR;
    UtR(1:3, 4) = UorgR;
    UtR(4,4) = 1;
    transfMatrix = UtR * RtS;
end
0 Comments
Answers (1)
  James Tursa
      
      
 on 28 Apr 2020
        TYpe this at the command line:
dbstop if error
then run your code. When the error occurs the code will pause with all current variables intact. Examine measured_offsphi and you will probably see it is not a scalar. Then backtrack in your code and figure out why.
6 Comments
  James Tursa
      
      
 on 30 Apr 2020
				Well, did you do what I suggested in my very first post?  That puts you in the debugger where you can figure things out.
See Also
Categories
				Find more on Robotics in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!