? Error: Missing MATLAB operator

Click For Summary
SUMMARY

The forum discussion addresses an error encountered in MATLAB 7.01 (R14) while executing the function FindPeaks.m. The user, Paula, receives a "Missing MATLAB operator" error when attempting to slice a string variable, fname, instead of a matrix. Warren suggests using the 'whos' command to inspect variable types, highlighting the need to ensure that fname is a matrix before applying the slice operator.

PREREQUISITES
  • Familiarity with MATLAB syntax and functions
  • Understanding of matrix operations in MATLAB
  • Basic knowledge of file loading in MATLAB
  • Experience with debugging MATLAB code
NEXT STEPS
  • Learn about MATLAB variable types and how to convert strings to matrices
  • Research the use of the 'load' function in MATLAB for different file formats
  • Explore MATLAB debugging techniques, including the use of 'whos' and breakpoints
  • Study MATLAB indexing and slicing operations for matrices
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those working with data analysis and function development, as well as programmers seeking to troubleshoot common MATLAB errors.

pvivas1
Messages
1
Reaction score
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


try writing its type as extension...
 


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
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
16K