필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

what happened with this code?

조회 수: 1 (최근 30일)
romasha
romasha 2014년 2월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
when i run this code following error is generated
% --- Executes just before fgui2 is made visible.
function fgui2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to fgui2 (see VARARGIN)
% Choose default command line output for fgui2
handles.output = hObject;
imgNameList = {'images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg'};
subplot(2,2,4);
pause on;
for i = 1:length(imgNameList)
a = imread(imgNameList{i});
imshow(a);
drawnow;
pause(3);
end
% Update handles structure
guidata(hObject, handles);
*Error*
function varargout = fgui2(varargin)
|
Error: Function definitions are not permitted in this context.

답변 (1개)

Walter Roberson
Walter Roberson 2014년 2월 1일
You cannot create functions at the MATLAB command prompt: you have to write them into files.
If it is already in a file, then there is something before that in the file that has been interpreted as being a script instead of a function. The first non-comment line of the file needs to start with "function".

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by