How to create an array with user inputs?
Mostrar comentarios más antiguos
Hello, I am trying to create an array with user inputs. For example, if the user types 3, 5, 7, the array comes out to be [3,5,7]. How can I do this? Thanks in advance for your help!
Respuestas (2)
Sulaymon Eshkabilov
el 5 de Ag. de 2021
0 votos
You can consider using input() prompt. See this doc with examples: https://www.mathworks.com/help/matlab/ref/input.html?s_tid=srchtitle
1 comentario
Soeun Lee
el 5 de Ag. de 2021
d bhaskar
el 24 de Feb. de 2023
clc
clear all
n=2; m=2;
for i=1:n
for j=1:m
fprintf('Enter a(%d,%d)=',i,j);
a(i,j)=input('');
end
end
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!