Note that there are some explanatory texts on larger screens.

plurals
  1. POReturn .m file help text in figure window
    text
    copied!<p>I have this function in a script:</p> <pre><code>function exp(source,eventdata,indx) global h; global d; global myslash; global experiment; global description; mddefaults = ([cd myslash 'parameters']); if exist(mddefaults, 'dir') defaults = [mddefaults ,myslash]; else defaults = [cd ,myslash 'parameters' myslash]; end mh = guihandles(gcf); filesel = d(indx).name ; experiment = filesel(1:length(filesel)-2); set(mh.ExpLabel,'String', experiment); descr = help(experiment); set(mh.description,'String', descr); </code></pre> <p>It is embedded in an .m file with a bunch of other functions to run my experiment. As you can see, this one goes into a directory and sets the experiment name and description based on the files in that directory (there are multiple possible experiments that can be selected between). However, it doesn't work, and I can't figure out why. To be more precise, the "ExpLabel" works, and the name of the experiment is displayed; however, the "description" does not work for every file. The confusing thing is it works for some files but not others, even though they are all formatted exactly the same. </p> <p>Any ideas? Do you need more of my script?</p> <hr> <p>EDIT1:</p> <p>Here is the code for the text uicontrols that the code in the OP is feeding:</p> <pre><code>uicontrol(mainfigure, 'Style', 'text',... 'String', experiment,... 'FontSize',10,'FontWeight','bold',... 'Position',[hpcont vpcont-30 hpcont+hsizecont*6 15],... 'Tag', 'ExpLabel'); uicontrol(mainfigure, 'Style', 'text',... 'String', description,... 'Max',2,'Min',0,... 'HorizontalAlignment','left',... 'Position',[hpcont vpcont-vsizecont*11.5 hpcont+hsizecont*6 275],... 'Tag', 'description'); </code></pre> <p>The first one works, the second one only sometimes works. Can't figure out why. And, again, no error message, it just doesn't display the text that it is supposed to. (Don't worry about the position stuff, that all works fine; I know it looks rather odd but that's irrelevant to this).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload