What is the best way to inspect a specific variable in jupyter? - jupyter

Short of printing a variable in a new cell, I don't know a good fast method to view a specific variable in jupyter.
I am aware of the Variable Inspector nbextension; but that shows ALL variables rather than a specific one.
Is there some way to do this which I'm missing?

Related

Is it possible to declare a persistent variable in a Stateflow subchart?

I'm using a Stateflow chart to generate some code (C action language). I would like to declare a subchart variable as persistent (or static), so the value is remembered the next time the subchart is executed.
A solution is to attach this variable to one of the parent states, but then this variable is visible to all the subcharts, which is not ideal.
Another solution is to create an embedded Matlab function with persistent variables on it, but this is too cumbersome, since I would need to read all the variables in the beginning and write them before leaving the state.
Is there a simpler way to achieve this?
Yes. Open Model Explorer, go to the subchart, add data.

MATLAB GUI - How do I remove the CreateFcn callback in my code?

I'm currently learning MATLAB's GUIDE gui programming. I notice that when I place some objects in a figure, a corresponding 'CreateFcn' callback function is creating in the associated .m file. MATLAB's comments state that this function is executed when the object is created (I would consider this a constructor for the object).
However, I've noticed that not all objects seem to have this 'CreateFcn' constructor. Static text objects do not appear to have this callback function. And as of currently, it seems like this function just makes the code more difficult to read. Thus I'm curious if I can delete.
By deleting it, I tend to get an error in my code stating that the function can't be found. So my question: is it possible to delete the 'CreateFcn' method to declutter my code?
Thanks,
Surely it is possible.
Double-click the object to open up the inspector window, locate the "CreateFcn" property and set its value to an empty string. Then go to the .m file and remove the code of CreateFcn. This way MATLAB wouldn't complain about the missing CreateFcn anymore.
CreateFcn is not really a constructor per se, since it happens after all properties of the object are already set. It is more like an optional post-constructor event that gives user an opportunity to further customize the object's initial behavior dynamically. For example, you can customize the object's color at creation depending on the background color on which the object appears. For most control objects, the default behavior is probably already good enough for you. So you can safely remove those CreateFcns until you find a good excuse to use one.
1) Goto the View --> Property Inspector
2) expand the Creation and deletion control, remove the text from CreateFcn and DeleteFcn 3) close the property inspector save the respective GUI (Don't forget to save)
4) remove the callbacks in m-script.

share some value between callbacks matlab GUI

i have four variables which two of them,named 'lat' and 'long' get value in a popup, and two others, named 'lat1' and 'long1', which get value in the same way in a different popup menu and this four, finally would be used in a third popup menu.
first i tried global variables but didn't work at all, then i tried handles structures and read every thing about it and read everything about sharing data and value between functions and callbacks and every question in stack overflow around this topic but it didn't help me.
It's hard to know exactly what you need from your description, but I'll guess that you have a main GUI and are using separate pop-ups to get inputs? I think from what you have said, you are on the right track.
The handles variable is what you want. It is really useful for sharing data throughout a GUI (if you have used GUIDE to set up your GUI environment then handles should be available, if not then you will have to set it up yourself by calling guihandles - more details here). If you save your variables into it, e.g.
handles.long = ..., handles.lat = ...
and update the variables with guidata(hObject,handles) then you should be able to access handles.long and handles.lat throughout your GUI.

How can I save specific window parameters in emacs

I use (current-window-configuration) to save the size, layout etc of windows, and (set-window-configuration ...) to restore them, so that I can toggle between several window setups. However (current-window-configuration) also saves the current point in buffers, and I would like to only save the window sizes and which buffers they hold. I have tried two different ways to make this happen:
According to the function help of current-window-configuration, the variable window-persistent-parameters controls whats get saved. So now I only need a list of the available window-parameters. But when I look at this variable it's value is ((clone-of . t)), and I can't find a list of the available window parameters online.
I also tried looking at the object returned by current-window-configuration. It is a window configuration object, and gets printed as #<window-configuration>. Is there a way to get into this object, see whats inside and change stuff?
The parameters for window-persistent-parameters may be found in this manual page, though it does not seem to help with your question. A different set of parameters may be found by running (window-state-get nil).
The functions that deal with objects returned by (current-window-configuration) are listed here, but it also mentions:
Other primitives to look inside of window configurations would make sense, but are not implemented because we did not need them. See the file winner.el for some more operations on windows configurations.
At any rate, all these look like really low level stuff, so you might be better off just using winner.el rather than a custom made solution.

Change local variable or function parameter in google chrome

I'm using chrome's devtools to debug/modify a non-local javascript file(so I can't edit it).
The code is rather complex and defines function inside of functions and uses these pointers throughout.
The point is that I do not know where I'm exactly at in the process but I can set a breakpoint to a variable I need to modify. BUT I can't figure out how to modify it. I can add a watch or modify it under the locals panel BUT it won't actually change (after stepping once the value reverts to original)
So how can I change the variable? I don't know why it is so difficult. In my traditional debugging you can simply edit the value in the watch or locals and it will modify it. I've tried modifying it at the console but I guess I don't know the complete path to the variable and I always get an undefined variable.
All I want to do is modify a local variable or argument in side some function I set a breakpoint at.
Try doing this in the console. E.g.: window.myVar = "newValue"
First watch the variable, second in Scope tab you can change the value of the var!