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

18 views (last 30 days)
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 Comment
Emerson De Souza
Emerson De Souza on 27 Mar 2013
Edited: Emerson De Souza on 27 Mar 2013
Hi, questions 2 and 3 are solved by:
FILENAME=strcat(answer{2,1});
writerObj=VideoWriter(FILENAME);
mkdir(FILENAME);
Now only question 1 is pending

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Mar 2013
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.

More Answers (1)

Lionel Juillen AF
Lionel Juillen AF on 7 Jan 2024
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 Comment
Lionel Juillen AF
Lionel Juillen AF on 7 Jan 2024
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

Sign in to comment.

Categories

Find more on System Composer in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!