How to create a custom function to output user variables?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
William Edwards
el 22 de Oct. de 2017
Comentada: William Edwards
el 22 de Oct. de 2017
I want to create a function named result() that I can use to print to the screen:
fprintf('\n*** Summary Data for Scenario:\n')
fprintf('%30s%12d\t%s\n', 'Runway Length:', runway, 'ft');
fprintf('%30s%12.1f\t%s\n', 'Rotation Speed:', rotate, 'knots');
where 'runway' and 'rotate' are user inputs from the rest of my code.
I tried:
function result()
fprintf('\n*** Summary Data for Scenario:\n')
fprintf('%30s%12d\t%s\n', 'Runway Length:', runway, 'ft');
fprintf('%30s%12.1f\t%s\n', 'Rotation Speed:', rotate, 'knots');
end
I want this in my code because the full result() function is (or would be) about 6 lines long and will be used multiple times.
1 comentario
Respuesta aceptada
Walter Roberson
el 22 de Oct. de 2017
function result(runway, rotate)
fprintf('\n*** Summary Data for Scenario:\n')
fprintf('%30s%12d\t%s\n', 'Runway Length:', runway, 'ft');
fprintf('%30s%12.1f\t%s\n', 'Rotation Speed:', rotate, 'knots');
end
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!