# Subscripted assignment dimension mismatch when cal back the function

1 view (last 30 days)
shahin hashemi on 24 Dec 2017
Answered: Image Analyst on 24 Dec 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

Image Analyst on 24 Dec 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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6177728,"math_prob":0.99938565,"size":790,"snap":"2020-34-2020-40","text_gpt3_token_len":351,"char_repetition_ratio":0.34223917,"word_repetition_ratio":0.0,"special_character_ratio":0.47848102,"punctuation_ratio":0.09917355,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99992347,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-24T13:04:18Z\",\"WARC-Record-ID\":\"<urn:uuid:90a68a86-6042-4df0-bd3d-a63ff9ba1722>\",\"Content-Length\":\"103070\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cb0bdf76-bf35-442b-a19f-586082671670>\",\"WARC-Concurrent-To\":\"<urn:uuid:0db45d2f-18d9-4cc2-ba0b-4c635c2adeb2>\",\"WARC-IP-Address\":\"104.117.0.182\",\"WARC-Target-URI\":\"https://in.mathworks.com/matlabcentral/answers/374386-subscripted-assignment-dimension-mismatch-when-cal-back-the-function?s_tid=prof_contriblnk\",\"WARC-Payload-Digest\":\"sha1:HET7L5SYSAPVU4C6I4EIM2ILY6SPNRKM\",\"WARC-Block-Digest\":\"sha1:ULNVWCUSFHCLT6CEBN4ZC5CMVIVNVORI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400217623.41_warc_CC-MAIN-20200924100829-20200924130829-00784.warc.gz\"}"}