MATLAB Answers

How to export XaxisTick Labels which are cell arrays to figure or powerpoint in app designer?

8 views (last 30 days)
Rohit Deshmukh
Rohit Deshmukh on 10 Mar 2020
Please refer to the attached figure. If i keep the XaxisTicklabels as 1,2,3 and so on, it can be exported to PPT or figure with the help of h = copyUIAxes(app.UIAxes,axh).
But if the XaxisTickLabels are as in attached image, it displays the following error:
"Value must be a vector of type single or double whose values increase"
How to proceed with this?

  7 Comments

Show 4 older comments
Adam Danz
Adam Danz on 11 Mar 2020
I see... I won't be able to troubleshoot this without running it. Could you attach the app and instructions how to recreate the error?
Update: Before you do that, I noticed in your error message,
Error in copyUIAxes (line 148)
however, the current version of copyUIAxes() shows that line of code on line 153, not 148. So, either something was altered in your file or you're not using the most recent version of copyUIAxes. So, first download the updated version and if the error continues, provide the new copy-pasted error message and attach the app.
Rohit Deshmukh
Rohit Deshmukh on 12 Mar 2020
I have updated the copyUIAxesVersion still the error continues:
I cannot attach the app here..
ERROR:
Error using matlab.graphics.axis.Axes/set
Value must be a vector of type single or double whose values increase
Error in copyUIAxes (line 153)
set(h.axes, uiaxGoodParams)
Error in SavePPTinFolder (line 59)
h = copyUIAxes(app.UIAxes,fNew);
Error in plotcreator/SaveasPPTButtonPushed (line 135)
SavePPTinFolder(app)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
Adam Danz
Adam Danz on 12 Mar 2020
Update, with some guessing work (that was necessary since I wasn't provided an example), I've been able to recreate the problem and am working on a solution.
The problem is that your historgram data are categorical the categorical properties aren't copied to the new axes.
I'll update you when a solution is ready.

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 19 Mar 2020
Edited: Adam Danz on 23 Mar 2020
@Rohit Deshmukh, please download and start using the new version of copyUIAxes() (verson 1.2.0, as of 19-Mar, 2020).
I've updated it to work with categorical histograms. Please let me know if you have any further problems.

  6 Comments

Show 3 older comments
Emil Alexandersen
Emil Alexandersen on 4 Apr 2020
Hi Adam. I have just found the exportgraphics fucntion and it works!. Many thanks though!
Wish you a lovely evening-

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!