Input doesn't work
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
I was working on writing a script but when I included the input function I received the following error: Attempt to execute SCRIPT input as a function: /Users/Jzhang/Documents/MATLAB/input.m Error in circle_area (line 2) radius=input('Enter the radius:'); I've tried the input function in other scripts as well and they were working before but not anymore. Can anyone help me figure out this problem? Thanks
採用された回答
Image Analyst
2013 年 10 月 8 日
0 投票
Don't call it input.m. input is the name of a built-in function. Call it something else, like myInput().
12 件のコメント
Jerry
2013 年 10 月 8 日
I understand that input.m is a name of a built-in-function. For this example I wanted the user to input a number for the radius, so i wrote radius=input('Please enter the radius:'). However that didn't work
Image Analyst
2013 年 10 月 8 日
Rename /Users/Jzhang/Documents/MATLAB/input.m to /Users/Jzhang/Documents/MATLAB/myinput.m or something like that.
Jerry
2013 年 10 月 8 日
I tried that and it still doesn't work.
Walter Roberson
2013 年 10 月 8 日
Okay now use
which -all input
and tell us what you get back.
Jerry
2013 年 10 月 8 日
so instead of radius=input('.....') use radius=which -all input('....') ?
ES
2013 年 10 月 8 日
no .. on the MATLAB command window, type
which -all input
it will show all the files with name input in your matlab path.
Jerry
2013 年 10 月 8 日
oh i see, i got the following: >> which -all input /Users/Jzhang/Documents/MATLAB/input.m built-in (/Applications/MATLAB_R2013b.app/toolbox/matlab/lang/input) % Shadowed
ES
2013 年 10 月 8 日
perfect... So rename the first file, to say 'troublesome.m'. Shadow effect will go. then run 'troublesome.m'
Hopefully your troubles will be gone.
Walter Roberson
2013 年 10 月 8 日
That would not have happened if you had done the renaming that Image Analyst suggested. Though you might have needed to use the command
clear input
after you did the rename.
Jerry
2013 年 10 月 8 日
I'm sorry I'm a beginner at matlab. So rename input.m to troublesome.m?
Jerry
2013 年 10 月 8 日
nevermind, i got it. Thanks!
Image Analyst
2013 年 10 月 8 日
Then please mark this answer as "Accepted."
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
