How to create an array with user inputs?
37 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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!
0 Commenti
Risposte (2)
Sulaymon Eshkabilov
il 5 Ago 2021
You can consider using input() prompt. See this doc with examples: https://www.mathworks.com/help/matlab/ref/input.html?s_tid=srchtitle
d bhaskar
il 24 Feb 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
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!