global GUI1
axes(handles.axes3);
[GUI1,] = uigetfile('*.mp4');
obj = VideoReader(GUI1);
video = obj.read();
axes(handles.axes3);
fps=30;
for i=1:max(video(1,1,1,:))
imshow(video(:,:,:,i));
pause(1/fps);
end
if true
% code
end
%%%%%%%
Error in untitled>Start_Callback (line 93)
imshow(video(:,:,:,i));

 Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 15 Mai 2016

0 Stimmen

Shahmeer - please copy and paste the full error message (I suspect there is more to it than what you have pasted above). Also, what does the above correspond to? Is this the body for the Start_Callback function or for something else? Please include the full function signature and body.
Part of the problem may be how you are iterating over video. If you want to iterate over each frame (the fourth dimension) then instead of using max (which will return the maximum value of the video(1,1,1,:)) you should be using size instead to get the array dimension as
numFrames = size(video,4);
for i=1:numFrames
% etc.
end

6 Kommentare

This is my error
Index exceeds matrix dimensions.
Error in untitled>Start_Callback (line 94)
imshow(video(:,:,:,i));
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in untitled (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)untitled('Start_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Shahmeer Rosli
Shahmeer Rosli am 15 Mai 2016
Here is my coding
Shahmeer - try replacing your line
for i=1:max(video(1,1,1,:))
with
for i=1:size(video,4))
Using max will return a maximum value and not the size of the fourth dimension (which is your number of frames).
New error
global GUI1
[GUI1,] = uigetfile('*.mp4');
obj = VideoReader(GUI1);
video = obj.read();
axes(handles.axes3);
fps=100;
for i=1:size(video,4);
imshow(video(:,:,:,i));
pause(1/fps);
end
setappdata(0,'video',obj);
handles.Start=video;
handles.current_video=video;
guidata(hOjects,handles);
Error
Undefined function or variable 'hOjects'.
Error in untitled>Start_Callback (line 96)
guidata(hOjects,handles);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in untitled (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)untitled('Start_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Walter Roberson
Walter Roberson am 15 Mai 2016
hOjects should be hObject
Shahmeer Rosli
Shahmeer Rosli am 15 Mai 2016
Tq

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by