I need the user to enter a vector with the dimension given by himself in a previus input which is componente variable.
Here's my code:
dist = zeros(1, componente); % Preallocate space.
definput = {'0'};prompt={'Insira as distâncias de cada trecho com um espaço entre elas'};titleBar= 'Distâncias dos trechos';dims=[1 50];dado=''; while isempty(dado) | length(dado) ~= componente % Ask user for a number.
dado = inputdlg(prompt, titleBar, 1, definput); if isempty(answer),break,end % Bail out if they clicked Cancel.
% Convert to floating point from string.
usersValue = str2double(answer{1}); % Check usersValue1 for validity.
enddist = dado;
Best Answer