Taking multiple inputs from user in one box in MATLAB
Show older comments
I want to take multiple values with waitfor operator but my code does not work. Where is my mistake?
methods (Access = private)
% Callback function
function ButtonPushed(app, event)
%Reading dataset and getting the inputs from user by using input operation
matrix = xlsread("Transfusion.xlsx");
attributesNum = size(matrix,2) - 1 ;
X = zeros(attributesNum,1);
for i=1:attributesNum
waitfor(app.firstVal, 'Value');
value = app.firstVal.Value;
X(i,1) = value;
%Update text of ValuesLabel (for demostrating the concept).
text = ['Values: ', sprintf('%.1f, ', X(1:i))];
app.ValuesLabel.Text = text(1:end-2);
end
%Display X in Command window for testing
disp(X)
...
end
Answers (0)
Categories
Find more on Language Support in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!