Undefined function 'uifigure' for input arguments of type 'char'.
이전 댓글 표시
i'm trying to make a program using matlab gui by calling a function
function aes
% Membuat GUI
figure = uifigure('Name', 'AES');
button = uibutton(figure, 'Position', [20 20 100 30], 'Text', 'PilihGambar', 'ButtonPushedFcn', @(btn,event) selectImage(btn));
editField = uieditfield(figure, 'Position', [140 20 200 30], 'Editable', 'off');
button2 = uibutton(figure, 'Position', [360 20 100 30], 'Text', 'Enkripsi', 'ButtonPushedFcn', @(btn,event) encryptImage(btn, editField.Value));
button3 = uibutton(figure, 'Position', [480 20 100 30], 'Text', 'Dekripsi', 'ButtonPushedFcn', @(btn,event) decryptImage(btn, editField.Value));
end
but always unable to run
the program can also run (by force) only produces a figure image without content (blank)
답변 (1개)
dpb
2023년 5월 12일
The function code works here although the controls are not spaced/sized such that they are all contained within the default uifgure size on this monitor; you'll need to ensure the size/locations of the controls you create is such as to all fit within the figure window. It would be best to ensure that size on creation, probably, or at least enquire and make sure things do fit.
A possible problem is that of using 'figure' as the handle for the created figure; that aliases the builtin figure function and who knows what possible ramifications that might have. Do NOT use the names of builtin core MATLAB functions as variables.
My preference is to always use the lowercase "h" as an indicatior of a handle for such variables, such as
hF=uifigure('Name','AES');
...
카테고리
도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!