rename ui file in matlab - matlab

I am working on a gui with guide in matlab. Inbetween I devided to name the file
different and renamed it. I also renamed all functions to the new filename in the .m file
and all objects in he .fig file.
However when I start the application I still see this error
??? Undefined function or method 'uiSchwingungen' for input arguments of type 'char'.
Error in ==>
#(hObject,eventdata)uiSchwingungen('edit1_CreateFcn',hObject,eventdata,guidata(hObject))
Where uiSchwingungen is the old not existing filename.
Where is this code section hidden (It is not in the .m file, and the .fig is binary)

You need to open the .fig in GUIDE, right click on an element (like a button), go into property browser, look for the CallBack property, click on its field to edit it, and you will find the text saying
#(hObject,eventdata)uiSchwingungen('edit1_CreateFcn',hObject,eventdata,guidata(hObject))
You will need to replace uiSchwingungen with the name name of that element (which will be in the Tag field of the Property Inspector).
Go through all the buttons, text boxes, etc., as this mistake probably will have occurred more than once.

Related

editing the values in a csv file in a project throws an "index out of range" error

I am trying to modify a program that was contracted by my company before I came to work there. The program uses a .csv file to contain the product numbers and values based on the product number. It seemed simple enough to remove the old file from the current project, and replace the old file with the new file of the same name. I changed the values in 1 record to make the update to pricing. There were no other changes.
After I deleted the old file by highlighting the file in the project, select delete and then select move to trash. I bring the new file in by dragging and dropping from finder. When the Choose options for adding these files comes up, I make sure the check box copy items if needed is checked. I also ensure that Added folders has the option button Create folder references is selected. Add to targets has my project name and is checked. Then I select finish.
When I try to run the program, I get an index out of range error.
While debugging I found that the columns loaded from the file look like this.
["DDN080120000MG35", "DDN.08.01.20000MG35", "DDN.08.01.20000 HE MG35", "MK28708-2000", "Solid Carbide Drill", "Aluminum", "Internal", "8 X D", "20", "20", "243", "190", "160", "484.00 €", "\"$\t715.60\"\r"]
["\u{1A}"]
The last record of the file doesn't have the ["\u{1A}"] shown just above. I ran the old program in debug and this doesn't appear when I set a breakpoint.
Does ["\u{1A}"] represent an EOF marker that shouldn't be there? Am I missing some sort of compile action that I need to take with the file before I load it? I'm lost. Any help would be appreciated.
The issue wasn't with the code. It was with the difference between Windows and IOS system and how they handle files. The numbers program in IOS was attaching a character at the end of the .csv file that already had an EOF marker on it. Xcode was confusing the original EOF marker from an Excel file as a record in the file causing an index out of range error. The answer was to open the original csv file in TextEdit, make the modifications and saving it back as a csv. Once I dropped it into the project, the problem was solved.

MATLAB GUI set default values

I am working on a GUIDE in Matlab and I have to constantly change a couple of Edit Text values.
I have realized that if I change the String value of an Edit Text from the property inspector in the .fig file it sticks there when I run the code even if I close Matlab and reopen it, so I suppose that it is stored somewhere. I would like to know if there is a way of changing those 'default' values while running the gui.
I want to add a pushbutton to set the displayed data as default, so it is kept for the next time I run the code.
Thanks very much in advance!
Not sure if there is a more elegant way, but you can do the following as a workaround:
Once the button is clicked
Create a file
Write new default values instead of older ones
At the start of GUI
Open the file
Get the default values
Set the default values on GUI

Matlab Calling 'Import Data' with GUI Button

I'm working in a GUI in Matlab R2014b that uses some data from a txt file, so i want to call the 'Import Data' window to permit the user select the data from a file when pushing a button. Is there a way to do this?
The function uiimport is used for importing data interactively. This seems to be what gets called by Matlab's toolbar's "import data" button.
Excerpting from the documenatation,
uiimport opens a dialog to interactively load data from a file or the clipboard. MATLAB® displays a preview of the data in the file.
uiimport('-file') presents the file selection dialog first.
S = uiimport(___) stores the resulting variables as fields in the struct S.
So, just set
uiimport('-file');
as the button's callback.

rename GUI file and callbacks

I've renamed My ".m" and ".fig" on the same name, in my "*.m" i've replaced occurrence of previous name with the new one.
Is any efficient way to rename a simple GUI file without renaming all the callbacks (in the property panel) on the "*.fig" file ?
Have so many callbacks and button that it's really fastidious to make it manually.
Thanks !
I usually open the .fig file in GUIDE, save it with an other name, and with default options a new .m file should be created with the new name.
Callbacks should also be renamed automatically if you didn't change their '%auto' option in GUIDE.
Hope that helps !

MATLAB: uiopen AND get the name of that file?

I have a GUI that has pushbuttons. You push the button, it allows you to choose a file to open then loads that file into the workspace using uiopen('load'). This part works fine:
Then I would like it to return the name of the file it just opened, so that I can use it for telling the next part of the program which data to look at, and to get the name of the opened file to display in an edit box in the GUI itself. First issue more vital than second. Any help would be appreciated
thanks
Actually the function 'uigetfile' is usually used for openning standard dialog box for retrieving files, and the format is like:
filename = uigetfile
or
[FileName,PathName,FilterIndex] = uigetfile(FilterSpec)
This function, displays a modal dialogbox that lists files in the current folder and enables you to selector enter the name of a file. If the file name is valid and the fileexists, uigetfile returns the file name as astring when you click Open. Otherwise uigetfile displaysan appropriate error message, after which control returns to the dialogbox. You can then enter another file name or click Cancel.If you click Cancel or close thedialog window, uigetfile returns 0.
one example could be:
[FileName,PathName] = uigetfile('*.m','Select the MATLAB code file');
Also, you can use 'uigetdir' for doing the same for directories.
In addition, you can check this link: for matlab
You can use uigetfile to get the name of the file and open it using load(filename).