Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab 2012b sees "squeeze" as a variable!!

Subject: Matlab 2012b sees "squeeze" as a variable!!

From: Luca

Date: 4 Apr, 2013 12:21:09

Message: 1 of 3

Hi!
I'm doing a thing that I've done lots of times with matlab but now, for the first time, I'm getting an error.
That happened with Matlab 2012b, with older versions, which I do not have anymore, this line used to work.
I simplified my code a lot, to exclude typos, but I get the error anyway.
Here's the problematic line:

imm = squeeze(data.data(:,100,:));

Already the code analyzer tells me that "squeeze might be used before it is defined". Which of course does not apply to a function.
If I run the code I get:
"At compilation, "squeeze" was determined to be a variable and this variable is uninitialized. "squeeze" is also a function name and previous versions of MATLAB would have called the function. However, MATLAB 7 forbids the use of the same name in the same context as both a function and a variable".

Now... Why on earth does Matlab 2012b think that "squeeze" is a variable, written in this way???

Subject: Matlab 2012b sees "squeeze" as a variable!!

From: Steven_Lord

Date: 4 Apr, 2013 13:31:50

Message: 2 of 3



"Luca " <l.presottoRE@MOVE.campus.unimib.NOTit> wrote in message
news:kjjr7k$jht$1@newscl01ah.mathworks.com...
> Hi!
> I'm doing a thing that I've done lots of times with matlab but now, for
> the first time, I'm getting an error.
> That happened with Matlab 2012b, with older versions, which I do not have
> anymore, this line used to work.
> I simplified my code a lot, to exclude typos, but I get the error anyway.
> Here's the problematic line:
>
> imm = squeeze(data.data(:,100,:));
>
> Already the code analyzer tells me that "squeeze might be used before it
> is defined". Which of course does not apply to a function.
> If I run the code I get:
> "At compilation, "squeeze" was determined to be a variable and this
> variable is uninitialized. "squeeze" is also a function name and previous
> versions of MATLAB would have called the function. However, MATLAB 7
> forbids the use of the same name in the same context as both a function
> and a variable".
>
> Now... Why on earth does Matlab 2012b think that "squeeze" is a variable,
> written in this way???

Because later on in your code you did:

squeeze = 17;

or something similar. That tells MATLAB that in this function, the
identifier squeeze refers to a variable. [You can't assign a value to a
script, function, or class.] This includes any instances of the identifier
that appear in the function prior to the line on which you assign it a value
as well as appearances in later lines.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Matlab 2012b sees "squeeze" as a variable!!

From: Luca

Date: 4 Apr, 2013 15:40:05

Message: 3 of 3

"Steven_Lord" <slord@mathworks.com> wrote in message
> Because later on in your code you did:
>
> squeeze = 17;
>
> or something similar.

Of course I didn't do "squeeze = 17".
But in the end it turned out that I did something that was interpreted like that.

permute(squeeze(image(:,round(index/2),:),[2 1]))
 that due to misplaced parenthesis in the end was read as "squeeze=17".

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us