how to give different combinations of inputs within the program( i want to skip input questions)?
Mostrar comentarios más antiguos
i have a program to which i am giving two sets of inputs at a time and getting two outputs combined in a column(set 1 output on top and then set 2 output) . but every time i have to enter these two set of values in command window.
for example, if i want to enter------
set 1. for f= 7,
enter c0= 1, r0= 3
set 2. for f= 9,
enter c0= 2, r0= 4
*how can i give these inputs within the program in form of sets ?
n in program shows number of input sets* Please see the program attached
3 comentarios
Geoff Hayes
el 22 de Ag. de 2014
reshdev - please format the above code so that it is readable. Highlight the code portions and press the {} Code button. If easier, just attach the poster.m file to your question using the paperclip button.
It isn't really clear what you mean by how can i give these inputs within the program? Do you want to skip the input questions and just pass a matrix like
inputData = [7 1 3;
9 2 4]
where n would be the number of rows, f the first column, c0 the second column, and r0 the third column?
dpb
el 23 de Ag. de 2014
Still not exactly clear what you intend/want -- if you do mean "pass" in the sense of function arguments, then you would just add an array to the argument list and supply it when you call the function just as any other Matlab function. You could use the optional arguments facilities to bypass the query if the array is present or choose to make it required and just take out the user input section entirely inside the function then. Your choice depending on what you want. See
doc varargin % and friends for the optional args details
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Scripts en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!