Matlab App Designer Array

5 vues (au cours des 30 derniers jours)
Can Akyol
Can Akyol le 25 Nov 2019
Modifié(e) : Ajay Kumar le 3 Déc 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

Réponse acceptée

Ajay Kumar
Ajay Kumar le 3 Déc 2019
Modifié(e) : Ajay Kumar le 3 Déc 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.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by