Error: The input character is not valid in MATLAB statements or expressions.

40 visualizaciones (últimos 30 días)
Amit Das
Amit Das el 25 de Sept. de 2020
Comentada: Amit Das el 26 de Sept. de 2020
I have tried to tun the following code(R2015a)
W=input('Enter width in m: ');
A=input('Enter area in sq. m: ');
%Since the hypotenuse of the right angle triangle is W
%and the rest of the side are D
%W^2=D^2+D^2
%=> D^2=(W^2)/2
%=> D=sqrt((W^2)/2)
D=sqrt((W^2)/2);
%Side D, height of triangle Ht and half of W make a right triangle
%D is hypotenuse, So
%D^2=Ht^2+(W/2)^2
%Ht=sqrt(D^2-(W/2)^2)
Ht=sqrt(D^2-(W/2)^2);
%area of triangle
A1=0.5*W*Ht;
%area of rectangle
A2=A-A1;
%finding length
L=A2/W;
fprintf("Length in m: %.3f\n", L);
%length of fence
LFence=2*(W+L)+W+2*D;
fprintf("Length of fence in m: %.3f\n", LFence);
But it is showing like this :
fprintf("Length in m: %.3f\n", L);
|
Error: The input character is not valid in MATLAB statements or expressions.

Respuestas (1)

madhan ravi
madhan ravi el 25 de Sept. de 2020
Change " to '
  3 comentarios
Steven Lord
Steven Lord el 25 de Sept. de 2020
madhan ravi showed you what to do. The reason why you need to do this is that the ability to create a string array using double quotes ("") was introduced in release R2017a.
Amit Das
Amit Das el 26 de Sept. de 2020
Ok I am using R2015a thats why I faced this error.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by