How can I stop image stretching using imshow in the new App designer?
34 views (last 30 days)
Chris Portal on 6 Nov 2016
There are a few ways to do this, depending on the complexity of your app...
1) The simplest would be to turn off the auto resize option in App Designer. Select the UI figure in App Designer's design view, and uncheck the Resize components when app is resized option. The downside is you will lose the convenient auto resizing of your components when the app window is resized.
2) If you'd like to keep the auto resizing of your components, you could try adding the following line to your App Designer code after you display your image. Assuming the UI axes in your app has been named "UIAxes":
set(app.UIAxes, 'Units', 'Pixels')
3) If neither of the above options are acceptable, you would need to implement a SizeChangedFcn in App Designer by right clicking on the UI figure and going to callbacks. This would allow you to have full control of how every component is resized, but would require you to code up the logic manually.
Hope this helps!