not formed from a valid identifier; using the end function for a simple m file.
3 ビュー (過去 30 日間)
古いコメントを表示
I am essentially copying the exact same code my prof used on powerpoint and yet the code keeps telling me this doesnt work. No matter what I put for the last line an error says " is not formed from a valid matlab identifier.
a=e^2
if a<x
disp ('a is less than x');
elseif a>x
disp ('a is greater than x');
end
[EDITED, Jan, code formatted]
2 件のコメント
採用された回答
Walter Roberson
2016 年 2 月 7 日
Please note that e and x are not predefined variables in MATLAB. If you want e to be the base of the natural logarithms then you would need to define it to be that,
e = exp(1)
e^2 in MATLAB would be written as exp(2)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で MATLAB Report Generator についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!