MATLAB 2010a surf bug? Can someone try to replicate?

  • Context: MATLAB 
  • Thread starter Thread starter mikeph
  • Start date Start date
  • Tags Tags
    Bug Matlab
Click For Summary

Discussion Overview

The discussion revolves around a potential bug in MATLAB 2010a related to the 'surf' function, specifically when attempting to pan the view after rotating the axis. Participants explore the issue, share experiences, and suggest alternative approaches.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes a problem encountered when using the 'surf' function in MATLAB 2010a, where the image does not pan correctly after rotation, leading to error messages.
  • Another participant suggests using the command 'axis vis3d' to potentially resolve the issue, theorizing that the problem may stem from MATLAB attempting to rescale the figure during rotation.
  • A different participant proposes using 'pcolor' instead of 'surf' for visualizing the data, questioning the necessity of 'surf' for the intended visualization.
  • The original poster expresses a preference for 'surf' to obtain images from various angles, particularly when looking straight down.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to resolve the issue, with differing opinions on whether to continue using 'surf' or switch to 'pcolor'.

Contextual Notes

The discussion highlights the variability in the occurrence of the error and the potential influence of specific commands on the behavior of the visualization. There are no resolved mathematical steps or definitive solutions presented.

mikeph
Messages
1,229
Reaction score
18
Hello,

anyone with MATLAB 2010a would you be able to type the few lines of code into try to replicate this problem I am having?

Code:
>> p = rand(400);
>> surf(p)

Once you get the image, maximise the window and rotate the axis until you are looking vertically down (z-axis out the screen). Then zoom into the bottom left corner, and try to pan.

When I do this, rather than 'grabbing' the image and moving it, the image stays in the same place and the frame gets moved to cover part of the image up. I then get the accompanying error messages pop up:

Code:
? Cell contents reference from a non-cell array object.

Error in ==> pan>locWindowButtonUpFcn at 486
        if ~isequal(newlim{1},origlim{1})

Error in ==> hgfeval at 63
        feval(fcn{1},varargin{:},fcn{2:end});

Error in ==> uitools.uimode.modeWindowButtonUpFcn at 44
hgfeval(newButtonUpFcn,hFig,evd);

Error in ==> uitools.uimode.modeControl>localModeWindowButtonUpFcn at 144
hThis.modeWindowButtonUpFcn(hFig,evd,hThis,newValue);
 
? Error while evaluating figure WindowButtonUpFcn

[PLAIN]http://img820.imageshack.us/img820/945/matlaberror.jpg

Sometimes this happens, sometimes it doesn't. I tried it three times with this example, and the error messages only came up twice. The second time I tried it, it seemed to work fine.

Any idea what I'm doing wrong, or if it's a MATLAB error?

Thanks,
 
Last edited by a moderator:
Physics news on Phys.org
Hey, I had similar problems quite a while ago, but this should help.

axis vis3d

Pretty sure that the problem arises from MATLAB trying to "refit/rescale" the figure as you rotate it. vis3d tells it to leave it scaled for 3d rotation.

give it a try
 
Thanks, that definitely did something, but I am still unable to pan properly.
 
I want a surf to get images from many angles, and am having particular trouble doing this in the case that I am looking straight down onto it.