Storing User Input in a Matrix
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am attempting to write code that takes user input in with the dialog boxes. But i need the user input to then be stored in a matrix as it is gathered.. Is there a way to do this? I have tried by places the dialog boxes in a while loop..
function[Source, resistors] = simplecircuit(voltage, current)
for cnt = 1:2
Source(cnt) = inputdlg({'Voltage Value','Node','Node'},...
'Source Placement',[1 10; 1 5; 1 5]);
end
for i = 1:2
resistors = inputdlg({'Resistor Value','Node','Node'},...
'Source Placement',[1 50; 1 12; 1 7]);
end
end
0 Commenti
Risposte (1)
Gregory McFadden
il 30 Set 2019
Have you tried just making a GUI for this? It is particularly easy to just have a table and use the cell edit callback to perform an action whenever a cell is edited. If the table length is highly variable, either in the cell edit callback or with a different function, extra rows can be added only when necessary.
Either in Guide or appdesigner, it is quite easy to handle these types of input tasks, then just have a button to command execution of the rest of your code once the table is populated.
0 Commenti
Vedere anche
Categorie
Scopri di più su Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!