GUIDE scrollfunction deleting figure
이전 댓글 표시
Hello, I have a question about my scrollfunction, I asked it here before but couldn't get a good response.
My question is this: I have a scrollfunction that works and works well. I have a gui I made in GUIDE with four axes, and the scrollfunction will change depending on the axes. My problem is this: depending on the rate at which I scroll, the figure can bug out and delete itself. After running some tics and tocs, I found the problem lies with how fast everything gets plotted.
When I scroll slower than it takes MATLAB to plot (~0.1/sec, meaning I can scroll upwards at 10 slices per second). When I scroll at a rate that would replot more than 10 times a second, it bugs out. THe reason I'm asking this, and just assuming its a MATLAB problem, is I have a separate duplicate programmatic GUI that does a identical process, with more or less the same code, that doesn't have this problem. I think the problem is within GUIDE.
Is this common, or is there a workaround? I tried to implement a pause of 0.1 seconds to try to get this bug to not occur, no dice. Regardless of what I do, whenever I try to scroll quickly, I have the figure deletion.
Thanks!
EDIT: Here are some segments of code from my UI. My scrolling function uses the mouse scroll wheel to go upwards and downwards in slices in a 3D matrix axially, sagittally and coronally by clicking on whatever GCA I want to sift through. My data consists of response data which I image in imagesc, and is again constructed in a 3D matrix. It represents a volume I export from a FEA utility.
I have attached the code to this question now as opposed to using gist.
These are the relevant graphics functions I employ at the moment. Besides that, here are some UI screenshots to help you get an idea of what my UI looks like:
And here is the error message I get when I scroll too quickly:
Error using drawnow
Error while evaluating DestroyedObject WindowScrollWheelFcn
Error using matlab.ui.Figure/set
Invalid or deleted object.
Let me know if you'd like me to upload anything else.
댓글 수: 7
matt dash
2014년 12월 10일
Hmm, i've never heard of this, so i'd say no it's not common. It might be a side effect of something specific in your code. You might try reading about the "busy action" and "interruptible" figure properties. Maybe you can use those to prevent it from calling the scroll function too often.
Geoff Hayes
2014년 12월 11일
Brian - can you post a simple example of the code that is exhibiting this behaviour so that others can take a look?
Brian
2014년 12월 11일
matt dash
2014년 12월 11일
You would need to post the "display" functions too... those are likely where the error is happening since they do the actual clearing/redrawing.
Brian
2014년 12월 12일
Geoff Hayes
2014년 12월 12일
편집: Geoff Hayes
2014년 12월 12일
Brian - why not just attach your code using the paperclip button? When you attach only part of the code, it makes more challenging to determine where exactly the problem is..especially if we can't run it. That's why a sample GUI with some of your code that produces the same behaviour makes debugging (for others) that much easier.
Brian
2014년 12월 14일
채택된 답변
추가 답변 (1개)
Image Analyst
2014년 12월 11일
0 개 추천
Exactly what is getting scrolled? Do you have a slider/scrollbar and are changing it, which changes some parameter which then causes a plot/graph/chart/image to change? Or do you have a scrollpanel for an image and you're scrolling the image (like in attached demo)?
Well, whatever it is or however you're doing it, maybe try putting in a "drawnow" at a strategic place to force update of the display. You might also want to totally reset the axes with a "cla reset" in between separate scroll operations.
댓글 수: 3
Brian
2014년 12월 11일
Image Analyst
2014년 12월 11일
Again, exactly what is being scrolled? A slider? An image? A panel? A screenshot would help immensely here.
Brian
2014년 12월 12일
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!