Why am i getting this error 'unrecognized function or variable' for the defined function itself

1 回表示 (過去 30 日間)
Jigar Gopani
Jigar Gopani 2022 年 6 月 22 日
編集済み: Stephen23 2022 年 6 月 22 日
function po(conc,p,k)
main_directory = "D:\Thesis'\New_samples";
s1 = 'PO_CN';
folder = fullfile(main_directory, strcat(s1, conc, '_', p));
sub_folder = fullfile(folder, strcat(s1, conc, '_', p, '_', k));
MM = readmatrix(fullfile(sub_folder,'MuellerMatrixausschnitt36 Bilder.txt'));
end
Error: PO "undefined function or variable"
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 6 月 22 日
Did you store the code in po.m ?
Image Analyst
Image Analyst 2022 年 6 月 22 日
編集済み: Image Analyst 2022 年 6 月 22 日
Are conc, p, and k all character arrays or strings? None are numbers, right?
How did your main program call the function "po", like what variable values did it pass to it?
Attach ALL THE RED TEXT, not just a snippet from it like you did. It should show line number, the actual line of code, and the full error message, including traceback.
Attach the po.m file. Does the capitalization of the file match that on the "function" line?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

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

回答 (1 件)

Stephen23
Stephen23 2022 年 6 月 22 日
編集済み: Stephen23 2022 年 6 月 22 日
clc % <---------- !!!!!!!!!!!!!!!!!! DELETE THIS LINE !!!!!!!!!!!!!!!!
% <- and this line too
function MM = po(conc,p,k)
...
end
If you want to call the main function po(), then you cannot have any other code before that function.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by