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

16 visualizaciones (últimos 30 días)
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 comentario
Emerson De Souza
Emerson De Souza el 27 de Mzo. de 2013
Editada: Emerson De Souza el 27 de Mzo. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Mzo. de 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.

Más respuestas (1)

Lionel Juillen AF
Lionel Juillen AF el 7 de En. de 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 comentario
Lionel Juillen AF
Lionel Juillen AF el 7 de En. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre System Composer en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by