Undefined function 'uifigure' for input arguments of type 'char'.

7 visualizzazioni (ultimi 30 giorni)
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)

Risposte (1)

dpb
dpb il 12 Mag 2023
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');
...

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by