Error in load.m? "Unexpected Matlab Operator"

5 ビュー (過去 30 日間)
fh_le
fh_le 2015 年 5 月 4 日
コメント済み: fh_le 2015 年 5 月 5 日
Dear community,
I'm quite new to Matlab, so please excuse if this is a stupid question:
I'm trying to load a .mat-file I've saved, but no matter whether I double click on it or type load(file), an error occurs:
Error: File: load.m Line: 1 Column: 1 Unexpected MATLAB operator.
load.m seems to be written in some sort of C or so, and maybe the problem then has something to do with the fact that I had to install a new gcc compiler recently (gcc 4.7.4) to be able to create a mex-file to run another script. Before I did that, load.m was working. But I don't know what to do now. Does anyone have a clue? Or am I overlooking something?
Thanks a lot!
  3 件のコメント
dpb
dpb 2015 年 5 月 4 日
And, following up on Stephen's likely surmise of the issue, if you use
clear load
and try again, more than likely it will again function correctly which would illustrate that you overloaded the builtin load function.
fh_le
fh_le 2015 年 5 月 5 日
No, I didn't define any load function on my own. Typing 'which load' gives: /scr/EXPERIMENTS/FH/matlab_mex/gcc-4.7.4/gcc/testsuite/objc/execute/load.m
Typing 'clear load' and trying to load something again gives the same error as before: Error: File: load.m Line: 1 Column: 1 Unexpected MATLAB operator.
The script load.m looks as follows:
/* Contributed by Nicola Pero - Wed Mar 7 17:55:04 CET 2001 */ #include objc/objc.h
/* Test that +load is automatically called before main is run */
static int static_variable = 0;
@interface TestClass { Class isa; } + (void) load; @end
@implementation TestClass + (void) load { static_variable = 1; } @end
int main (void) { if (static_variable != 1) { abort (); }
return 0;
}

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

採用された回答

Titus Edelhofer
Titus Edelhofer 2015 年 5 月 5 日
Hi,
you might not but it seems that Nicola Pero did some years ago ;-). The location of load.m indicates that it belongs to some testing, but it's not the load that comes with MATLAB.
Second, it's not a MATLAB file at all: although it's name is ".m" it's clearly a C/C++ or ObjC file.
Remove that folder from the MATLAB path (e.g. using pathtool) and it should look much better.
Titus
  1 件のコメント
fh_le
fh_le 2015 年 5 月 5 日
That worked! Thanks a lot! =)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by