Matlab GUI, sometimes listbox disappears. I used: set(handles.listbox,'value',1) and seems it does not work - matlab

In the GUI, I have two listboxes, and the data in these two listboxes can be passed to each other. A user can pass all the data to the other one, he can also select some data and pass to the other one.
The problem is: Sometime, the listbox will disappear, but all the pushbuttons works as expected. And Matlab gives a warning: Warning: multi-selection listbox control
requires that Value be an integer within String range.Control will not be rendered until all of its parameter values are valid.
I did some research, someone advises to use this: set(handles.listbox,'value',1) . But it does not solve this problem.
And what's more, I cannot figure out under what kind of circumstance this error may happen.
Can you guys please tell me how to solve this? And in which case this error may happen?
Thanks a lot.

Related

unit.variable not found as numeric variable in foo Synth Package

I am trying to run the Synthetic Control Method in R. I tried to prepare my data according to Abadie, Diamond and Hainmueller (2011) (https://www.jstatsoft.org/article/view/v042i13).
But when running the dataprep.out function I get the error message that my unit.variables are not nurmeric variables in foo. I don't understand the problem here because my table purely consists of numeric values. The table is also classified as a data.frame. I have attached some pictures to underline my problem. If anyone could help me that would be greatly appreciated!
My code (https://i.stack.imgur.com/7BVYc.png)
My table (https://i.stack.imgur.com/TV1IC.png)
I have tried to reimport my data over and over again. But nothing seems to help.

How to pass between guis in matlab

I am doing a group project and we are supposed to be using GUIS to create a presentation. In the presentation there is data that is loaded in using an edit text box and our code then goes through calculations and if statements and is supposed to pass certain values to a different GUI. Our instructors do not know how to do it because we have asked them on several occasions and they cannot figure it out. We have tried varargin method and the getappdata method and neither one is working. Does anyone have suggestions? PLEEAASE!!
I would write some "Controller" program that will know open the figures for you and know how to forward the data. Basically it would be a simplified mvc-pattern. It could also assure the figures are opened in correct order.

Why does the Function Module name of a Smartform change (sometimes)?

Not really critical question, but i'm curious
I am working on a form and sometimes the generated function name is /1BCDWB/SF00000473, and sometimes /1BCDWB/SF00000472. This goes back and forth.
Does anyone know what's the idea behind this? Cuz i'm quite sure it's not a bug (or i might be wrong on that).
It is not a bug. You always have to use SSF_FUNCTION_MODULE_NAME to determine the actual function module name and call it dynamically using CALL FUNCTION l_function_module.
Smartform FMs are tracked by internal numbering and thats saved in the table STXFADMI. You would always notice the different number in Development System if you have deleted any existing Form. Similarly, you would also notice the different number in your Quality system based on the sequence the forms are imported in QAS and the forms as well (as test forms are not migrated to QAS.
Similar behavior is also true for Adobe Form generated FMs.
You need to understand that every smartform has a different interface and hence the automatically generated function module needs to have different import parameters.
Due to this reason the 'SSF*' FMs generate a FM specific for your smartform. The name of the 'generated' FM changes when you migrate from one system to another. And that's the reason why you should use a variable while calling the 'generated' fm and not hardcode it.
The same goes with Adobe form as someone has rightly said in this thread.

MATLAB error: Error Saving Figure: "Object must have an ancestor of type 'figure'"

In MATLAB 2012a,
I'm trying to save a figure as a .fig file, and all I get is a window with
Title: Error Saving Figure
Message: Object must have an ancestor of type 'figure'.
I googled this error message, and Google was able to predict my search perfectly, meaning other people have searched the same error message before .. however there is not a single page online that actually discusses this error.
I know that I haven't given much information, and I apologize for this, but I can't imagine what other details to give. 2 minutes ago I saved a different figure generated by the exact same program, in the exact same way, as a .fig file with no problems.
What does this error message mean and how do I fix the problem so that I can save figures in .fig format again ?
Edit: I am trying to save the file from the GUI.
Your problem seems to relate to how the GUI builds the figures:
* the parent object is of type 'figure'
* this object has some children of (usually) type 'axis'
* most graphical objects (lines, text, etc) belong to an axis.
It appears to go wrong with figures that have not been built the 'figure;plot(),etc...' way, eg with objects added later to the figure (eg 'legend') or plots that have been made with custom commands ('hist', 'bar3', etc).
My guess is that some GUI object has been added that does not have the figure handle as its 'ancestor'.
Queries about this problem outside StackOverflow seem to involve matlab function
"getproxyvaluefromhandle". Maybe googling that helps. Someone found help decomposing a figure here (seems to be a mix of Matlab, English and German)
If you have no code can you at least please describe what's in the figure? Otherwise the answers will be as hand-wavy as the question...

Drupal - dynamic options for text_list field

I have a custom node type for which I want to have a field that uses a special combobox based on list_text. When one chooses the type list_text it is normally possible to enter a static list of selectable texts, however, I want this list to be dynamic, i.e. based on the results of a db_query. What is the best way to do this using Drupal 7?
A simple example for clarification: A node of this custom type X contains a field that points to another node, so whenever a node of type X is created I want a combobox that contains all other nodes.
(Best solution would be to only display the combobox during node creation, and no longer during edit. But I could also live with it if the combobox was shown during the edit as well.)
I have tried to customize options_select by defining my own data type and implementing hook_options_list accordingly. The combobox was displayed during creation with the correct values, however, I could not save it.. I have no idea what went wrong there, but on the first submit it would change to a different theme, and when I tried again I got an internal server error. Am I on the right track at all with defining a completely new data type for the field? there surely must be a simpler way?
You're right in that you don't need a new datatype. Here's a good tutorial on how to do this. It's not specifically for D7 but I didn't see much that wasn't still applicable. There may be a better way to do it in D7 specifically but I would love to know it too if so :)
The tutorial linked by allegroconmolto sent me on the right way. Thanks for that.
Here's the simpler way of doing it: tutorial
Basically, it is, as I assumed, a common problem and hence a simple solution for it was included in the webform module by now. It provides a hook_webform_select_options_info which can be used to register a callback method. The callback method is then called each time a corresponding option select of a webform is shown, so that you can easily fill it with the results of a dbquery or anything else. Works like a charm and takes next to no time to implement.