dear all this is my cod
function [Rl] = basisfunction1(j,N) L=1; x = sym('x', [1 3], 'real'); for i=j-1 Rl(:,:,j)=[cos(x(3*i-2))*cos(x(3*i-1))*cos(x(3*i))-sin(x(3*i-2))*sin(x(3*i)) -cos(x(3*i-2))*cos(x(3*i-1))*sin(x(3*i))-sin(x(3*i-2))*cos(x(3*i)) cos(x(3*i-2))*sin(x(3*i-1));sin(x(3*i-2))*cos(x(3*i-1))*cos(x(3*i))+cos(x(3*i-2))*sin(x(3*i)) -sin(x(3*i-2))*cos(x(3*i-1))*sin(x(3*i))+cos(x(3*i-2))*cos(x(3*i)) sin(x(3*i-2))*sin(x(3*i-1));-sin(x(3*i-1))*cos(x(3*i)) sin(x(3*i-1))*sin(x(3*i)) cos(x(3*i-1))]; end end
and i save it in basisfunction1.m and i run my main cod in other m file that is like :
N=1;for j=2:N+1Rl(:,:,j) = basisfunction1(j,N);end
but i get this error : Subscripted assignment dimension mismatch
i realy apreciated if some one can help
Best Answer