How to change my unit to SI?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Samy Ben Thabet
el 9 de Oct. de 2018
Respondida: Image Analyst
el 9 de Oct. de 2018
Hi I am writing a program that calculates the area of a given shape, here is an example for a square. The problem is that when I enter s=5, the end result of A is 2809 when it should be 25.
Here is the program
h=input('What shape do you want?:','s'); if strcmp(h, 'square') s=input('The length of a side is (m):','s'); A=s*s disp(A) end
0 comentarios
Respuesta aceptada
Star Strider
el 9 de Oct. de 2018
The problem is that you do not want to use the 's' option if you want a numeric input. (The 's' specifies a char input.)
Do this instead:
s=input('The length of a side is (m): ');
That will give you a numeric result for ‘s’ here.
0 comentarios
Más respuestas (1)
Image Analyst
el 9 de Oct. de 2018
For what it's worth, see my attached spatial calibration demo.
0 comentarios
Ver también
Categorías
Más información sobre Entering Commands en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!