Subscripted assignment dimension mismatch when cal back the function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
shahin hashemi
il 24 Dic 2017
Risposto: Image Analyst
il 24 Dic 2017
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+1
Rl(:,:,j) = basisfunction1(j,N);
end
but i get this error : Subscripted assignment dimension mismatch
i realy apreciated if some one can help
0 Commenti
Risposta accettata
Image Analyst
il 24 Dic 2017
basisfunction1 returns a 3-D array R1. Now in
Rl(:,:,j) = basisfunction1(j,N);
you're trying to stick a 3-D array into one plane of the R1 array. You can only put a 2-D image into the j'th plane, not a 3-D image.
0 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!