? Error: Missing MATLAB operator

FindPeaks.m using MATLAB version 7.01(R14).- The program is supposed to load a file named fname.dat and then use the log10 scale to find peaks in the data.- However, when Warren tries to run the program using his file sam_2mem_e1.FLT.a.171, he gets an error message saying there is a missing MATLAB operator.- Warren asks for suggestions and Paulatry suggests checking the types of variables and using file extensions.
  • #1
pvivas1
1
0
? Error: Missing MATLAB operator

Hi I am trying to run a program (My version of MATLAB is 7.01(R14))
called FindPeaks.m

function [peaks]=FindPeaks(fname)

eval(['load fname.dat -ascii'])
eval(['timedata=',fname,'(:,1);']); % log10 scale !
eval(['amplitude=',fname,'(:,2);']);

*****************
then I enter my file which doesn't have any extension:

my file name is: sam_2mem_e1.FLT.a.171
then

FindPeaks('sam_2mem_e1.FLT.a.171')
? Error: Missing MATLAB operator.

Error in ==> FindPeaks at 5
eval(['timedata=',fname,'(:,1);']); % log10 scale !


Thank for any suggestions
Paula
 
Last edited:
Physics news on Phys.org
  • #2


try writing its type as extension...
 
  • #3


You're trying to apply the (:,1) slice operator to a fname, which is a string, not a matrix. Throw a 'whos' in there and look at the types.

- Warren
 

What does the error "? Error: Missing MATLAB operator" mean?

This error typically means that there is a syntax error in your MATLAB code. It could be caused by missing parentheses, brackets, or operators in your code.

How can I fix the error "? Error: Missing MATLAB operator"?

To fix this error, carefully check your code for any missing operators or incorrect syntax. Make sure all parentheses and brackets are paired correctly and that all operators are used in the appropriate places.

Why am I getting the error "? Error: Missing MATLAB operator" even though my code worked before?

This error can occur if you have made changes to your code that have resulted in incorrect syntax. It's possible that you accidentally removed an operator or added an extra one, causing the error to appear.

Can a missing MATLAB operator error also be caused by a missing variable?

No, a missing MATLAB operator error specifically refers to an issue with syntax and operators in your code. If you are missing a variable, you will likely receive a different error, such as "Undefined variable" or "Unrecognized function or variable" instead.

Are there any tools or resources that can help me avoid missing MATLAB operator errors?

Yes, MATLAB has a built-in debugger tool that can help you identify and fix syntax errors in your code. Additionally, there are online resources and forums where you can seek help and advice from other MATLAB users if you are encountering frequent missing MATLAB operator errors.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
7K
  • Programming and Computer Science
Replies
2
Views
555
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
Back
Top