MATLAB: Matlab App Designer Array

app designerMATLAB

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

Best Answer

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.