How to resize axes programmatically within a GUI built with uifigure and uigridlayout?
Hi everyone,
I’ve been building a GUI based on a uifigure and the matlab.apps.AppBase tools. It’s not built in App Designer, I do it programmatically. I use a uigridlayout to position my various items; it works quite well for most things, but I’m having trouble with uiaxes.
These uiaxes are located within the uigridlayout, but I need to make a slight size adjustment after they’ve been created. I just need to adjust the width, I know by how many pixels to adjust it. If I run my app by typing "app = appName();" in the command window, the app shows up, the uiaxes are not adjusted. I then issue the command in the command window: "app.myAxes.Position(3) = app.myAxes.Position(3) – boxWidth;", which does exactly what I need it to do.
However, adding that line of code in the code that builds the actual GUI does not work, no matter where I try to put it. I’ve set AutoResizeChildren of the uifigure to off, no luck. I’ve searched here, but nothing I found seems to work.
So how do I get my app to execute that particular line of code?
Cheers,
ChristianeHi everyone,
I’ve been building a GUI based on a uifigure and the matlab.apps.AppBase tools. It’s not built in App Designer, I do it programmatically. I use a uigridlayout to position my various items; it works quite well for most things, but I’m having trouble with uiaxes.
These uiaxes are located within the uigridlayout, but I need to make a slight size adjustment after they’ve been created. I just need to adjust the width, I know by how many pixels to adjust it. If I run my app by typing "app = appName();" in the command window, the app shows up, the uiaxes are not adjusted. I then issue the command in the command window: "app.myAxes.Position(3) = app.myAxes.Position(3) – boxWidth;", which does exactly what I need it to do.
However, adding that line of code in the code that builds the actual GUI does not work, no matter where I try to put it. I’ve set AutoResizeChildren of the uifigure to off, no luck. I’ve searched here, but nothing I found seems to work.
So how do I get my app to execute that particular line of code?
Cheers,
Christiane Hi everyone,
I’ve been building a GUI based on a uifigure and the matlab.apps.AppBase tools. It’s not built in App Designer, I do it programmatically. I use a uigridlayout to position my various items; it works quite well for most things, but I’m having trouble with uiaxes.
These uiaxes are located within the uigridlayout, but I need to make a slight size adjustment after they’ve been created. I just need to adjust the width, I know by how many pixels to adjust it. If I run my app by typing "app = appName();" in the command window, the app shows up, the uiaxes are not adjusted. I then issue the command in the command window: "app.myAxes.Position(3) = app.myAxes.Position(3) – boxWidth;", which does exactly what I need it to do.
However, adding that line of code in the code that builds the actual GUI does not work, no matter where I try to put it. I’ve set AutoResizeChildren of the uifigure to off, no luck. I’ve searched here, but nothing I found seems to work.
So how do I get my app to execute that particular line of code?
Cheers,
Christiane uiaxes uigridlayout MATLAB Answers — New Questions