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

16 ビュー (過去 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
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
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSystem Composer についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by