Matlab App Designer Array

4 ビュー (過去 30 日間)
Can Akyol
Can Akyol 2019 年 11 月 25 日
編集済み: Ajay Kumar 2019 年 12 月 3 日
I am a civil engineering student in METU, in Turkey. I wrote a code that makes 2D Structural Analysis. Now I want to Design an App by using App Designer in Matlab.
My program basically gets variable sized array type inputs and as an output also gives couple of arrays depending on the input data.
My question is that, How I can create a variable user-interface :
For example, user says there are 4 inputs, Then user needs to write the x-y coordinates of the nodes. Thus, he needs an (4,2) sized array area to write inputs.
How can ı create an input interface like that?
Thank you.
Can AKYOL

採用された回答

Ajay Kumar
Ajay Kumar 2019 年 12 月 3 日
編集済み: Ajay Kumar 2019 年 12 月 3 日
doc inputdlg
for eg, to get the number of inputs:
prompt = {'Enter number of inputs:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {'0'};
answer = inputdlg(prompt,dlgtitle,dims,definput)
and then run a for loop based on user input.
for i = 1:str2double(cell2mat(answer))
prompt = {['x',num2str(i)],['y',num2str(i)]};
dlgtitle = 'Input';
dims = [1 35];
definput = {'0','0'};
answer = inputdlg(prompt,dlgtitle,dims,definput);
my_data(i,1) = str2double(cell2mat(answer(1)));
my_data(i,2) = str2double(cell2mat(answer(2)));
end
Your matrix with 4x2 will be in the my_data.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by