Displaying multiple lines in MATLAB GUIDE text edit box

조회 수: 8 (최근 30일)
Alexander Suleimani
Alexander Suleimani 2021년 7월 28일
답변: Rik 2021년 7월 28일
Hello! I am trying to create a GUI using Matlab's GUIDE feature, and I want to display the file paths of folders that users choose for processing. I have a callback function on a "browse folders" button. The "selected_directory" handles represents the text box I want to print to, while the "browse_files_btn" is the handle for the button that executes the code below.
When the user hits the button, a file explorer appears, and I want it to display all the user-selected files, each on a new line.
Here is what I have so far, but this throws the following error:
"Warning: Single line Edit Controls can not have multi-line text"
I have seen answers to this question in the App Designer, but I am using GUIDE instead, so those don't apply. Can anyone help?
function browse_files_btn_Callback(hObject, eventdata, handles)
filename = uigetfile('*.txt','Select Relevant Files','MultiSelect','on')
numfiles = length(filename)
for i = 1:numfiles
set(handles.selected_directory, 'String', filename)
end
end

답변 (1개)

Rik
Rik 2021년 7월 28일
You need to make sure the max property is set to a large enough value, and that the uicontrol type supports multiple lines.

카테고리

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