Subscripted assignment dimension mismatch

1 次查看(过去 30 天)
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

回答(1 个)

Andreas Goser
Andreas Goser 2015-1-30
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 个评论
seprienna
seprienna 2015-1-30
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;

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by