Info

此问题已关闭。 请重新打开它进行编辑或回答。

subscripted assignment dimension mismatch

1 次查看(过去 30 天)
Subscripted assignment dimension mismatch.
Error in guiast>pushbutton6_Callback (line 528) C(rowspan,colspan,1) = R1;
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in guiast (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)guiast('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Here is the code
C(rowspan,colspan,1) = R1;
C(rowspan,colspan,2) = G1;
C(rowspan,colspan,3) = B1;

回答(1 个)

David Young
David Young 2015-9-3
You do not say how rowspan and colspan are calculated, but the problem is that they do not match the size of R1 (or the other two arrays, probably). The solution depends on what you want. If rowspan and colspan are correct but you do not want the whole of R1, try
C(rowspan,colspan,1) = R1(rowspan, colspan);
% etc
assuming R1 is a 2-D matrix and rowspan and colspan represent a part of it.
If you want the whole of R1 etc. you can use
rowspan = 1:size(R1, 1);
colspan = 1:size(R2, 2);
to get the correct ranges.

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by