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 件のコメント
Walter Roberson
2018 年 12 月 24 日
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()
Raktim Borpatragohain
2018 年 12 月 24 日
回答 (2 件)
Cris LaPierre
2018 年 12 月 24 日
0 投票
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 件のコメント
Raktim Borpatragohain
2018 年 12 月 24 日
Cris LaPierre
2018 年 12 月 24 日
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.

Raktim Borpatragohain
2018 年 12 月 24 日
Cris LaPierre
2018 年 12 月 24 日
編集済み: Cris LaPierre
2018 年 12 月 24 日
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.
Walter Roberson
2018 年 12 月 24 日
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 .
Raktim Borpatragohain
2018 年 12 月 24 日
Cris LaPierre
2018 年 12 月 24 日
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?
Raktim Borpatragohain
2018 年 12 月 24 日
Raktim Borpatragohain
2018 年 12 月 24 日
Cris LaPierre
2018 年 12 月 24 日
編集済み: Cris LaPierre
2018 年 12 月 24 日
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.
Raktim Borpatragohain
2018 年 12 月 24 日
Raktim Borpatragohain
2018 年 12 月 24 日
Cris LaPierre
2018 年 12 月 24 日
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);
Raktim Borpatragohain
2018 年 12 月 24 日
Walter Roberson
2018 年 12 月 24 日
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.
Raktim Borpatragohain
2018 年 12 月 25 日
Raktim Borpatragohain
2018 年 12 月 24 日
編集済み: Cris LaPierre
2018 年 12 月 24 日
0 投票
1 件のコメント
Cris LaPierre
2018 年 12 月 24 日
編集済み: Cris LaPierre
2018 年 12 月 24 日
Use a comment, not a new answer when replying.
カテゴリ
ヘルプ センター および 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!


