Set agent monitor window size in Netlogo - netlogo

I use a monitor window and mouse coordinates to get a closer look at certain parts of my model. Is there any way to set the size of the agent monitor window somewhere in the inspect procedure? If the magnification level could be set at the same time, that would be even better. I couldn't find anything in the dictionary. I know that you can set the size of the static monitors by opening up the text version of the model by playing with the dimensions as below:
MONITOR
610
1074
791
1119
NIL
int-step-len
17
1
11
However, I can't figure out a way to do this for a dynamic window, and I'd like to not have to manually resize and zoom in. Any help would be appreciated!

Related

Changing the number of divisions in graph scale

I'm having a little problem with graph scale in visio. My goal for now is to make a graph scale (belongs to charting shapes) with 22 divisions in it. But I don't know how to add an option of 22 divisions on the scale (2, 4 and 5 division options are available).
I have tried to add 22 division option in "Define Shape Data" window, but unlucky.
I have searched whole internet for the solution, but I found no solution.
I hope someone here will know the solution.
Just adding 22 to the options will not magically make 22 divisions appear. You will also need to have the shapes (or geometry sections) behind it (22 of them, not just 2, 4 or 5) to be made visible when 22 is selected.
You need to understand how the whole shape is constructed, by looking at the various group sub-shapes (and/or geometry sections) to see how each is made visible/invisible when the 2/4/5 selection is made.

How can I control which monitor plots are displayed on?

I have a 3 monitor Gentoo Linux system running MATLAB. MATLAB runs on the center monitor. I need MATLAB to generate plots on the left monitor but it always plots on the right monitor.
I believe this is at least partially caused by the non-standard way I have my monitors arranged physically - essentially 2,3,1:
>> get(0,'MonitorPositions')
ans =
1 1 1920 1080
-3839 1 1920 1080
-1919 1 1920 1080
Is there a way I can control this as a default within MATLAB?
You can set the default figure position on the root object like so:
set(0, 'DefaultFigurePosition', [-3839 1 1920 1080]);
This will create windows that fill the left monitor by default. However, this default will likely reset each time you restart MATLAB, so you will have to put it in your startup file if you want it to persist from session to session.
Note: The documentation for the 'MonitorPositions' property of the root object says this:
The first two elements in each row indicate the display location with respect to the origin point. The last two elements in each row indicate the display size. The origin point is the lower-left corner of the primary display.
If you change which monitor is used as the primary display, the relative coordinates in the left two columns will change, meaning you will have to change the position value in the above line of code. If you think the display setup may change often, or you will be running code on different monitor setups, then you can ensure plots will always appear on the left-most monitor by looking for the monitor position with the lowest value in the left column. Here's how you could do it (also incorporating the previous default window size and position within a monitor):
monitorPos = get(0, 'MonitorPositions');
figurePos = get(0, 'DefaultFigurePosition');
[~, leftIndex] = min(monitorPos(:, 1));
set(0, 'DefaultFigurePosition', figurePos + [monitorPos(leftIndex, 1:2)-1 0 0]);

Matlab: GUI resizes if i use getpixelposition

I made a GUI where i would like to have the position from, in pixels. I set the "Resize behaviour" to "Proportional"
Now i use
Position = getpixelposition(Test)
Test is the name of the GUI. I added a button to the Gui. Once i click on the button the code runs. But what happens, is that the screen shifts location. It was full size, now it shifts. 38 pixels to the right and 61 down.
Anybody an idea why this is?
Maybe other solutions to get the postition of my GUI?
I can't reproduce this behavior on my system (Win32 + MATLAB2012a).
However, to see what causes it:
type in your Command Window:
edit getpixelposition
set a breakpoint at the beginning of the function;
trigger the code tha calls getpixelposition;
step into the function (F11 preferably), and notice when the change of the position takes place; the executed statement would be the cause.
To get the position in pixels, you may use the undocumented hgconvertunits. From the .m file:
Y = HGCONVERTUNITS(FIG, X, SRCUNITS, DESTUNITS, REF) converts
rectangle X in figure FIG from units SRCUNITS to DESTUNITS
using the object with handle REF as the reference container for
normalized units. REF can be the root object.

figure('Position',[x y width height]) won't go over height 800

I'm using an external monitor. My notebook has display of height 800 px, but monitor has over 1000 px. If I'm running the script on external monitor
screenSize = get(0,'MonitorPositions');
figureSize = screenSize(4);
figure('Position',[0 0 figureSize figureSize])
the size of the new figure won't go over the size of notebook display. Is there a way how to fix this?
EDIT
I have found that if I start MATLAB while having already set the external monitor as an output device, the script runs just ok. Is there any way how to reset settings, that are responsible, before running the skript?
You probably want:
figureSize = screenSize(monitorNumber,4);
As screenSize(4) will give you the 4th element in the matrix - same as screenSize = screenSize(:)
By default figures are displayed on the primary display. If you want to force Matlab to show figures on the external monitor, you need to set the DefaultFigurePosition to a value that is actually on the secondary monitor.
Therefore, let's say you create a figure and drag it on the external monitor. Then you can fetch the current position and set it to the default like so:
FigPos = get(gcf,'Position');
set(0, 'DefaultFigurePosition', FigPos);
Then figures will subsequently appear on the external monitor with a size that fits. That's not perfect since you need to create a figure, drag it and then delete it and it's only valid for your current session. However you can add the previous lines of code in your startup.m file to do it automatically.
Hope that helps somehow!

Matlab - resizing figure

I have a GUI which has 10 panel in it. My LCD is 20". When I want to see my GUI in my laptop(15.6") I can not see my Panels properly. I have examined all the solutions, but I can not solve this problem.
Can anyone help me?
To resize the figure just change its Position property. The panels will resize according to it, depending on how you specified your panel units. I.e., to maximize a figure:
set(figH,'Units','normalized');
set(figH,'Position',[0 0 1 1]);
In the case you want to specify your figure size as pixel units do:
set(figH,'Units','pixels');
set(figH,'Position',[left_gap_nPixels bottom_gap_nPixels length_nPixels width_nPixels]);
Btw, I haven't mentioned, but figH is your figure (or panel handle, if you want to resize it). You can use gcf if it is your current active handle.
Just as reference, the units you can specify are:
{'inches' 'centimeters' 'characters' 'normalized' 'points'
'pixels'}
Consider checking the figure properties documentation and uipanel properties for more details on the position and units property.
Hope it helps.
Take a look at property Units.
The size of a graphic object may be expressed in pixels, in characters, or better (for you) proportionally to the size of the parent.
If you change the units of the sizes of all the Panels to be proportional to the size of the main window, it will be ok. For the main window, simply use get(0,'ScreenSize'); to get the screen size in pixels.