Matlab App Designer Array

5 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by