Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

subscripted assignment dimension mismatch

1 Ansicht (letzte 30 Tage)
Lakshmipriya S
Lakshmipriya S am 3 Sep. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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;

Antworten (1)

David Young
David Young am 3 Sep. 2015
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.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by