Undefined function 'analysis_callbacks' for input arguments of type 'double'. Error while evaluating uicontrol Callback

I didn't write this code but imported it to my home computer because our lab was moving away. I am trying to figure out why my command 'analysis_callbacks' isnt working. I am supposed to calculate the gradient from a summary file but as soon as the summary file opens, and i click on analyse, the aforementioned command appears on my matlab screen.

2 个评论

That code needs an older version of MATLAB to execute properly, as it calls legend() with a parameter that has not been supported for a while now.
However, I do not see the error you report. As long as the file you provided is on your MATLAB path the problem you mentioned should not occur. Make sure to add it to the path, though, in case you cd()
Thank you Walter.
any auggestion on which version of Matlab should i use? My lab computer had R2013b as well, so im little confused as to why it wouldnt work in mine. The code is written to generate a small time program called "analyse" where then i add a summary file. Until then everything is ok, once i try to take the readings from my summary file, i do face the issue. i downloaded RF toolbox and copy pasted all the files into the "bin" folder of matlab. should that work? how do you add cd?

请先登录,再进行评论。

回答(2 个)

It sounds like you are using a gui. How was this created? Using Guide or programmatically?
I suspect it is a path issue. If in guide, rt click on your button in the fig file (not the the running gui), select 'Property Inspector', and see what is set for the Callback. There is probably a hard-coded path to where the analysis_callback lived on the computer you copied the program from. Update this with the actual path on your computer.

16 个评论

Hi Cris,
It could be a path issue since I copy pasted the entire folder and I was told that's how it works (sine it worked in many other computers), the person who created it moved to Australia from the US and nobody is able to trace him, and that's why this mess.
I am a little daft with respect to computer programming. I don't see 'Property Inspector' when I right click any .fig file on my MATLAB 2013b screen. All the files in that folder are opened on my left panel in MATLAB.
Is there a way to figure out from the code I attached where is it calling from? I had copied all the files so whatever files were there are also in my PC. Moreover, the PC I was working on also had this same thing copied from somewhere else, so it wasn't 'installed' on that pc either.
Thank you
Is the gui running in MATLAB or is it a stand-alone executable?
You say you have to "click on analyze" to run this callback. Is there a button you click?
Not sure exactly how to get to the properties in 13b, but it shouldn't be too hard to figure out. You want to see something that looks like this. Note the Callback here is internal to the Gui and not an external *.m file.
guiCallback.png
yes, it runs on matlab.
i open matlab first and then type analyse
another screen pops up called analyse where i can input my summary file(.su2) and then the summary screen opens which is basically a figure of different contractions and i have to get the gradient from that figure.
the problem arises when i click on the gradient button in the analyse screen. there are two options to choose from "Gradient Method" and "Least Squares". The error shows up and im unable to measure the parameters. Everything until that point is same as how it was in my lab. But the error never appears on the lab computer.
To answer you other question, the only file attached is the analysis_callback.m file. There is not enough info there to see where it is called from. This file is the target of a callback. All info about path, etc is in the file doing the calling.
How are you starting up the gui? If you have all the files, there should be a *.fig file and a *.m file with the same name. Type 'guide' in your command window and then navigate to and open the analyse.fig file. That is where you want to view the properties of the button.
It might be worth going through some introductory material on Gui's. See this page.
if you can attach a zip with all of the code and a couple of sample data files then I will test it for consistency .
Sure,
Here you go: This folder contains all the files with the codes required to run it on Matlab R2013b
If there is nothing in the callback property, clicking on that button will do nothing.
You are now talking about 'Vertical Slice'. Let's first resolve the "Analyse" callback error you originally asked about. Look at the properties of the "Analyse" button. What is in that callback field? Is there a path? Does that path correct for your computer?
Some sample files to test. There's also a JPEG image so you know how it should look like.
.su2 are the files that should 'ideally' be working on matlab.
sorry my bad, I didn't know the property inspector has to be with specific to each thing on that screen, I thought it was a general command for one specific screen. But, here it is for 'analyse'. The path is 'analysis_callbacks(4)' .... I checked the code, analysis_callbacks is a function to call something and it is present in every segment of the code. But, I dont know why the (4) is there, that (4) doesn't exist in the main code.
As long as analysis_callbacks.m is in the same folder as analysisControl.m and analysisControl.fig, you should not be getting the error "Undefined function 'analysis_callbacks'"
Callbacks are functions that accept input arguments. The callback text is 'analysis_callbacks(4)', so the first input in the function analysis_callbacks is set to 4 (option).
Scroll through the code and you'll see that what code gets executed depends on what the value of option is.
Yes, they are all in the same folder.
This is the exact error:
Undefined function 'analysis_callbacks' for input arguments of type 'double'.
Error while evaluating uicontrol Callback
I don't understand how to rectify this
I figured what went wrong. I am able to work on it now... The moment I open the .su2 file which is on another folder, my left panel of matlab automatically goes to that folder, when I click the back button and bring the left panel back to 'analyse' folder, it works fine.
Is there a way to fix this?
Yes. Comment out line 129 in your analysis_callbacks.m file (option 1 loads the summary file). It's the line that changes your current directory to the folder the summary file is in.
cd(pathname);
Commenting out is done by putting a '%' at the beginning of the line. Comments are green in MATLAB
% cd(pathname);
I ran my analysis tool on what you provided; there does not appear to be any obvious flaws in the .fig . All of the callbacks and graphics properties are reasonable.
thank you Walter for running the program for me. much appreciated

请先登录,再进行评论。

So this is my screen with the pop up. Now, when I use the analysisControl.fig and use the property inspector button, my callback function is blank. Here it is attached. Do you know if that's a default thing or what I should put in there and save it?

类别

帮助中心File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by