Undefined Function Error for 'title.m' - What's Going On?

In summary, the conversation is about encountering an error message for a specific m-file and seeking an explanation for why this may happen. The conversation also includes the sharing of an m-file that includes a condition blocks example for calculating snow melt.
  • #1
buildingblocs
17
1
I am occasionally coming across this message for a given m-file 'title.m':


Undefined function or method 'title' for input arguments of type 'char'.



Even for very basic scripts this happens. An explanation of what exactly is going on would be much appreciated
 
Physics news on Phys.org
  • #2
Can you post the m-file? (You can use
Code:
tags.)
 
  • #3
Code:
%Condition blocks example.
reserve = 100; %initial amount in the reservoir
allreserve = []; 
alloutflow = [];
for i = 1:20; %perform the following statements 20 times
    if reserve < 30
        lossrate = 0.3;
    else
        lossrate = 0.2;
    end %if reserve...
    outflow = lossrate * reserve; %calculate the amount of the snow that melts
    reserve = reserve - outflow; % subtract this amount from the reserve
    disp(['after day' num2str(i) ' outflow= ' num2str(outflow)...
        'reserve=' num2str(reserve)]);
    allreserve = [allreserve reserve];
    alloutflow = [alloutflow outflow];
end %for i ...
hold off
plot (allreserve, 'g-')
hold on
plot (alloutflow, 'r-')
 

Related to Undefined Function Error for 'title.m' - What's Going On?

1. What is an undefined function error?

An undefined function error occurs when the code tries to call a function that has not been defined or is not recognized by the program.

2. Why am I getting an undefined function error for 'title.m'?

This error is most likely occurring because the function 'title.m' has not been properly defined in your code or is not recognized by the program.

3. How can I fix an undefined function error?

To fix an undefined function error, you will need to properly define the function in your code or make sure that it is recognized by the program. This may involve checking for typos or ensuring that the function is properly imported or included in your code.

4. Can a typo cause an undefined function error?

Yes, a typo in the function name or any other part of the code can cause an undefined function error. It is important to carefully check your code for any typos or errors that may be causing the issue.

5. Is an undefined function error a common issue?

Yes, an undefined function error is a common issue that can occur in programming. It is important to carefully check your code and make sure all functions are properly defined and recognized by the program.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
17K
Replies
4
Views
16K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
Back
Top