How to create a dialogbox with two or more input fields BESIDES EACH OTHER?
조회 수: 15 (최근 30일)
이전 댓글 표시
INTRO: Hi, I wrote the script below to make a video with images stored in a folder.
clear all; close all;
prompt = {'ENTER THE PATH:','ENTER THE VIDEO NAME:','ENTER THE NUMBER:','ENTER THE PLAYBACK RATE:'};
dlg_title = 'MAKE VIDEO';
num_lines = 1;
def = {'C:\Users\EMERSON\Desktop\test','test','10','5'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
oldFolder = cd (answer{1,1});
writerObj = VideoWriter('answer{2,1}');
NUMBER_OF_FRAMES = str2num(answer{3,1});
FRAME_RATE = str2num(answer{4,1});
writerObj.FrameRate = FRAME_RATE;
open(writerObj);
for k = 1 :1: NUMBER_OF_FRAMES
filename = sprintf('%d.bmp', k);
thisimage = imread(filename);
writeVideo(writerObj, thisimage);
end
close(writerObj);
mkdir('answer{2,1}');
cd(oldFolder);
As you can see, the input dialog has 4 lines BELOW each other to enter the variables.
QUESTION-1: I would like to have TWO input lines BESIDES instead of BELOW each other. The dialogbox should look like below:
ENTER THE PATH ENTER THE VIDEO NAME
input input
ENTER THE NUMBER ENTER THE PLAYBACK RATE
input input
QUESTION-2: The name of the video is not being used as a string. It saves as answer{2,1}.avi instead of test.avi.
QUESTION-3: Similar to above, I want to create a new folder using the name of the file as the name of the new folder. But it creates a folder named answer{2,1} instead of test.
So I wonder if someone could help me to correct the lines above to do what I want.
Thanks in advance for your help
Emerson
채택된 답변
Walter Roberson
2013년 3월 27일
inputdlg() is not designed to be able to show prompts beside each other. You would have to make a copy of it and edit the copy to do what you wanted.
댓글 수: 0
추가 답변 (1개)
Lionel Juillen AF
2024년 1월 7일
Hello
I found this reply..but very old (==>2011), and the modified inputdlgcol.m does not work with R2022b. :-(
I am interested in a simple-to-call dialog box widget on several lines and columns...
댓글 수: 1
Lionel Juillen AF
2024년 1월 7일
https://fr.mathworks.com/matlabcentral/answers/101271-is-it-possible-to-reshape-the-column-of-edit-boxes-in-inputdlg-such-that-the-questions-span-multiple
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!