Clear Filters
Clear Filters

Subscripted assignment dimension mismatch

1 view (last 30 days)
seprienna
seprienna on 30 Jan 2015
Commented: seprienna on 30 Jan 2015
to any kind folks, pls help me to find a solution the the error below: Subscripted assignment dimension mismatch. your kind help is greatly appreciated
for a =1:30
for P=1:1
o=(P-1)*30;
for r=1:2
if r==2
t=-4;
pA1(1:13+t,1:13+t,r,P)=A(17*r-16+o:17*r+t+o,1:17+t); <-- error begins here
pB1(1:13+t,1,r,P)=B(17*r-16+o:17*r+t+o,1:17+t);
beta(r,P)=A(17*r-16+o:17*r+t+o,a)\B(17*r-16+o:17*r+t+o,a);
else
t=0;
pA(1:13+t,1,r,P)=A(17*r-16+o:17*r+t+o,a);
pB(1:13+t,1,r,P)=B(17*r-16+o:17*r+t+o,a);
beta(r,P)=A(17*r-16+o:17*r+t+o,a)\B(17*r-16+o:17*r+t+o,a);
end
end
end
end

Answers (1)

Andreas Goser
Andreas Goser on 30 Jan 2015
This cannot be run:
Undefined function 'A' for input arguments of type 'double'.
Error in xxx (line 13) pA(1:13+t,1,r,P)=A(17*r-16+o:17*r+t+o,a);
Need to speculate. When the first error comes it calls A(1:13,1:13). You can find out if A has those sizes.
  1 Comment
seprienna
seprienna on 30 Jan 2015
i'm trying to create a partition for 25 x 30 , 1st-17 2nd-13 my A is 17x17 how can i create 2 beta ( 17x17 & 13x13) please advise the way forward.thank you
A=randi(20,25,30); % creating random A
beta_r = randi(10,30,30); % creating random beta
B = A*beta_r;

Sign in to comment.

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!