Error: The input character is not valid in MATLAB statements or expressions.
41 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (1)
madhan ravi
il 25 Set 2020
Change " to '
3 Commenti
Steven Lord
il 25 Set 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.
Vedere anche
Categorie
Scopri di più su Matrix Indexing 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!