フィルターのクリア

keep "Error: File: nozzlecalculator.m Line: 24 Column: 19 Local function name must be different from the script name".What i posted below is a part of a function scriptnamed nozzelcalculator, so when try calling it from main script i get this error.

3 ビュー (過去 30 日間)
function outlet = nozzlecalculator(Athroat,Aexit,Pstagnation,Pback)
if Athroat < Aexit
output('user input is valid')
else
error('Athroat must be less than Aexit')
end
% Calculate the first critical pressure (Pc1)
Mexit = areamachnumber(Athroat,Aexit,false);
Pc1 = staticpressure(Pstagnation,Mexit);
end
  1 件のコメント
Rik
Rik 2020 年 10 月 23 日
What don't you understand about the error message? Either rename your script or your function.

サインインしてコメントする。

回答 (1 件)

Monisha Nalluru
Monisha Nalluru 2020 年 10 月 27 日
When ever your are creating local function with in a script, the function name and script name should be different.
You can either change the function name or script name depending upon the usecase.
Refer the following documentation for local functions

カテゴリ

Help Center および File ExchangeEnergy Production についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by