필터 지우기
필터 지우기

How to use set to change a property of a uicontrol?

조회 수: 5 (최근 30일)
theblueeyeswhitedragon
theblueeyeswhitedragon 2018년 4월 10일
답변: Walter Roberson 2018년 4월 10일
function [] = script2()
fig = figure('units','pixels','position',[300 300 500 400], 'menubar','none','name','GUI_3','numbertitle','off','resize','off');
listh = uicontrol('style', 'list', 'unit', 'normalized', 'position', [0.25, 0.4, 0.5, 0.5], 'string', {'one';'two';'three';'four'}, 'FontSize', 14);
pushbuttonh = uicontrol('style', 'pushbutton', 'unit', 'normalized', 'position', [0.375, 0.125, 0.2, 0.1], 'FontWeight', 'bold', 'string', 'Submit', 'FontSize', 14, 'Callback', @pushbuttonh_Callback);
texth = uicontrol('style', 'edit', 'unit', 'normalized', 'position', [0.35, 0.25, 0.275, 0.075], 'String', 'Enter New String', 'FontSize', 12.5);
function pushbuttonh_Callback(source, value)
oldstring = get(listh, 'String');
addstring = {get(texth, 'String')};
oldstring{5} = addstring;
set(listh, 'String', oldstring);
end
end

채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 10일
Change
addstring = {get(texth, 'String')};
to
addstring = get(texth, 'String');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by