Matlab App Designer Array

1 Ansicht (letzte 30 Tage)
Can Akyol
Can Akyol am 25 Nov. 2019
Bearbeitet: Ajay Kumar am 3 Dez. 2019
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

Akzeptierte Antwort

Ajay Kumar
Ajay Kumar am 3 Dez. 2019
Bearbeitet: Ajay Kumar am 3 Dez. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by