MATLAB GUI Program Chrashes on .fig Load - matlab

I made some updates to my GUI .fig file - renaming everything (someone else created the initial GUI), moving things around, and adding a couple objects. I don't think I tried running the program/GUI without generating an error, but the last time I tried running it, I got a crash (which I could NOT Shift+F5 out of - I had to close MATLAB) that said something about an error loading the .fig file that was (probably) associated with a createfnc (or the like). I checked the GUI's .m file, and I thought all the renames had gone through.
Has anyone else experienced this?
Is there a way to force the GUI's .m file to update (i.e. force the changes on the .fig through to the .m)?
Anyone know how to fix this?
Thanks!

Related

The names/symbol of the blocks in Simulink dissapeared ¡

I don't have much experience with simulink but everything was working fine until the symbols inside the blocks (integrator, merge, unary minus...) dissapeared and now it is just a white square (they continue working tho). I haven't modified the format or similar that I can recall.
I have also tried to delete those blocks and import new ones from the library browser but the problem persist.
How can I fix this problem?
PD: I can't upload an image sorry :((
I had a similar problem in the past, I used the next commands in the command window.
restoredefaultpath
rehash toolboxcache
It will take some time, but might work.

Trigger MeshLab reload by script

Is it possible to reload a 3d object in MeshLab by an external script?
I know reloading an object can be achieved by pressing the refresh button (see image below). However, I would like to know if this behaviour can be triggered externally.
The reason I would like to be able to do this is because I want to use MeshLab as a visual tool to see the objects I've created with ImplicitCad. Object are created by writing code, which can be executed to produce an .stl file. MeshLab can read the file to show me the object I made.
When I save my code I would like to run a script that:
creates an .stl file from my code (This can be done using extopenscad)
reloads the object loaded in MeshLab (I don't know how to do this, or if it is even possible)
Thanks in advance to anyone who can help me!

Save Matlab figure without plotting it and afterwards open it in VISIBLE state

I have the same question asked here: Save Matlab figure without plotting it?
But the problem with the solution given there is that I can't open the saved figures in visible state with doubleclick afterwards. Looks like the savefig command saves the visible state. Same with saveas.
h=figure;
set(h,'Visible','off');
savefig('TestExample.fig');
b=openfig('TestExample.fig');
With this command I can see the figure, but I simply want to doubleclick and see it:
set(b,'Visible','on');
The best solution for me is (thanks for links, How to edit property of figure saved in .fig file without displaying it):
figure('Visible','off')
set(gcf,'Visible','off','CreateFcn','set(gcf,''Visible'',''on'')')
savefig('Test.fig')
close
Figures don't pop up and I can open them visible with doubleclick only.
The documentation seems to shed some light on the issue:
Create a surface plot and make the figure invisible. Then, save the
figure as a MATLAB figure file. Close the invisible figure.
surf(peaks)
set(gcf,'Visible','off')
savefig('MySavedPlot.fig')
close(gcf)
Open the saved figure and make it visible on the screen.
openfig('MySavedPlot.fig','visible')
...however, sadly it probably will not work when you use the double-clicking interface. The issue has been discussed also here, and would require changing the default behaviour of openfig. It is possible by editing the built-in function, but kind of dirty.
Another workaround solution is suggested in the comments further down by Jesse Hopkins:
Set the ResizeFcn on the figure to renable visibility. According to Matlab documentation, and in practice, ResizeFcn is called when figure is created:
set(h,'ResizeFcn','set(gcf,''visible'',''on'')');
The nice thing is, this workaround should work for setting on-load any property you might want to set on the figure handle being loaded.

Difference between position of elements of GUI before and after open it in GUIDE in MATLAB

I'm designing a GUI with GUIDE. When I open a window in GUIDE and after that run it, position of elements like panels,radio buttons and etc are difference with when I run MATLAB and directly run a GUI from .m file. It is a confusing problem because the real positions are that I'm running from .m file.
All elements of the window are nearly 1 cm to the right compared to when running it directly and I have a little vertical difference between these two. I should design a window and after that close MATLAB and run it directly to see the real positions! If I directly open it from .m file after using GUIDE, there isn't any difference with running from GUIDE and run from .m file. I have to restart MATLAB to see the difference.
What is your idea about this problem? How can I solve it?
Idea 1
This is more of a workaround rather than a solution:
What you could do, after positioning all elements in GUIDE, is to export the figure to an .m file (you don't actually need the .fig in order to have an interactive figure) using the menubar option File > Export ... in GUIDE.
This way you'll get an .m file with all the elements' positions hardcoded. If you change the position values from that file, there is absolutely no chance that they'll appear someplace else.
Idea 2
Try setting the Resize behavior of the GUI to Non-resizable. This is accessible from the GUIDE menu by Tools > GUI Options...

eclipse won't overwrite files in the save location

Got an assignment due,
Trying to save the files that I've just coded over the original skeleton files, and then move them to my desktop, every time i save all or save as, then click yes to overwrite them in the place i have the project saved, I take them off my computer, and put them onto the desktop, and they are just skeletons that have no work that I have put in them, just what we were given for the original assignment.
Any ideas?
It's because you're a fool and are looking in the wrong workspace.