How to create a dialogbox with two or more input fields BESIDES EACH OTHER?

18 次查看(过去 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
  1 个评论
Emerson De Souza
Emerson De Souza 2013-3-27
编辑:Emerson De Souza 2013-3-27
Hi, questions 2 and 3 are solved by:
FILENAME=strcat(answer{2,1});
writerObj=VideoWriter(FILENAME);
mkdir(FILENAME);
Now only question 1 is pending

请先登录,再进行评论。

采纳的回答

Walter Roberson
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.

更多回答(1 个)

Lionel Juillen AF
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
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 System Composer 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by