MATLAB ? Error: Missing MATLAB operator

AI Thread Summary
The discussion revolves around an error encountered while running a MATLAB program called FindPeaks.m, specifically the "Missing MATLAB operator" error. The user attempts to load data from a file named "sam_2mem_e1.FLT.a.171" but faces issues due to incorrect handling of the file name. The problem arises from trying to apply the slicing operator to a string instead of a matrix. A suggestion is made to check the variable types using the 'whos' command to diagnose the issue further. The error highlights the importance of ensuring that the correct data types are used when manipulating data in MATLAB.
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
1
Views
10K
Replies
2
Views
3K
Replies
3
Views
3K
Replies
7
Views
3K
Replies
5
Views
15K
Replies
2
Views
7K
Back
Top