I have a rather large routine which will can run for a couple of hours. Here and there it creates a figure, plots something to it and saves that Figure.
As I have only one PC, I would like to continue to work with that machine. The problem is that whenever a new figure is made, MATLAB becomes the active application again.
Is there any way to tell MATLAB or Windows that MATLAB should not be allowed to set itself to active?
I saw that one possibility is to run a MATLAB script totally in the background (like that). But that is a little bit too unsupervised, as I would like to be able to switch to the MATLAB window and check the output to the command window.
Any ideas? If there is a general solution for Windows that prevents that other Applications to become active would also be cool!
You can overload the figure function as following in order to prevent figure poping up:
a = figure('visible','off');
I hate to state the obvious, but you could always store the data you want to plot until the end.
Now, you're going to tell me that some of that data is subroutines and doesn't get passed back to the main routine. OK. So, the solution to that would be to write a "Store_Plot_Data" class with a method that would write into memory the data, the #plot_function_name (for 3D, scatter, etc.), the axis label strings, etc. Then you would create one instance of this class in your main routine and to ensure visibility of this one instance to all subroutines you could do any of the following:
use a global variable as your single instance ... OK, not so elegant,
implement the Singleton pattern, or
pass all subroutines the handle to that one instance of the "Store_Plot_Data" class.
If there is a general solution for Windows that prevents that other
Applications to become active would also be cool!
In Windows 7, this worked for me:
http://pcsupport.about.com/od/windowsxp/ht/stealingfocus02.htm
Set "HKEY_CURRENT_USER\Control Panel\Desktop\ForegroundLockTimeout" to 30d40 (hex).
If you want all figures to not show.
set(0,'defaultFigureVisible','off');
In the beginning of your script do:
set(0, 'DefaultFigureVisible', 'off');
set(0, 'DefaultFigureWindowStyle', 'docked');
Dock the Matlab figure window and maximize any other application (Excel, Word etc.) you are working with in front of Matlab.
Then you can continue to work without being interrupted by figures blinking on your face.
Related
I am basically trying to script a GUI control panel that allows users to accelerate the train with a power lever (in the GUI) and a reverser (Forward, Neutral, Reverse)
I have made two scripts. One is a localscript, the other being a regular script. The regular script enables the GUI on a player's screen when the player sits in the seat. The localscript is what makes the GUI function.
I've scripted the entire thing but only the regular script seems to function, The localscript does not seem to function as it is scripted to. The GUI appears on the screen but when pressed it does nothing.
Here are the contents of the localscript
http://pastebin.com/raw/XnT2Bi2X
Here's are all the objects in the Workspace that is mentioned and relevant to the script:
https://s31.postimg.org/4hd2up2ij/Screen_Shot_2016_06_24_at_11_15_21_AM.png
What are the errors in the localscript that is not allowing the GUI to function as its scripted to?
(I apologize for the long script and thank you for your help in advanced)
Note: The codes are Lua (which are used on the ROBLOX Studio Platform)
First off, thanks for writing out a clear and concise question. Most of the questions under this tag are all over the place :).
I would verify that you LocalScript instance is being properly initialized inside of the Player instance that is sitting down. Looking over your LocalScript's code, I don't see any errors that would cause the GUI not to function (if the LocalScript is being initialized properly), which leads me to believe the LocalScript isn't even running. If you are loading the LocalScript into the player on spawn (so, putting it into the PlayerScripts folder), there's your problem. This would cause the GUI to not be set up properly, as it hasn't been inserted into the players PlayerGui instance yet, so the LocalScript won't be able to hook up the MouseButton1Click events or anything of that sort.
So, make sure that the LocalScript starts running once the player sits in the seat (use the regular Script that displays the GUI to also move a copy of the LocalScript into the player). This will (hopefully) initialize the LocalScript properly, and allow it to hook into the GUI.
If this doesn't work, check your output window for any blatant errors, and post em here.
Cheers!
-widoreu
Okay, as Title says.
For example, i use NAudio to playback what i record (loopback if you want).
And if i click on the GUI (the top part, so i can move the window).
It will cause a "sleep", and when that happens the current activity (Audio playback) stops.
And then it continues afterwards.
But i want to remove that, as i don´t know any other application that has it, so it´s probably something to do with how i am programming.
Please keep it simple, i am extremely new to c#.
I am guessing on Bakckgroundworker or something, but i couldn´t get it to work.
So hopping for a more concrete answer.
This was just me not understanding that using the Main Thread in a window form will cause anything on the GUI to be run on it.
Meaning, if i move the GUI, that movement will be Priority over the rest of the code, so everything else will get paused if run on that thread.
Perhaps it differ from object to object, but in this scenario it was the case, so i just moved it to a separate thread and it´s solved.
I have a GUI menu on Matlab with 4 buttons (menu.fig). Then I have 4 .fig file that I want to open when I click on the buttons. Here it's all ok, when I open a .fig from menu and insert value to do a plot I get this error:
???? Attempt to reference field of non-structure array.
If I try to open 1.fig directly, everything works perfectly.
I read that the problem is with eval(), but I can't solve it.
I changed the variable names on each .fig file
One 1.fig:
function pbutton1_Callback(hObject, eventdata, handles)
A1=get(handles.edtSAmp,'String');
f1=get(handles.edtSFreq, 'String');
fi1=get(handles.edtSFase, 'String');
t1=get(handles.popTipo, 'Value');
A1=str2double(A1);
f1=str2double(f1);
fi=str2double(fi1);
SinalSinusoidal(A1,f1,fi,t1);
I got the error on the that 1st line.
I guess this is something MATLAB GUI not handled well. I know it used to work, but when you tweaking your UI or UI related code a bit and accidentally you modified some area MATLAB told you not to touch, this kind of issue begin to happen.
The workaournd is to start the GUI from M editor by clicking run
I know it works, but originally, when I directly lauch it , it works too. so, this is not the end of it, people are just not getting to the end of it.
The problem is with probably with handles1. It's not a structure array like you expect it to be. In GUI's created with GUIDE, this variable is usually called handles, if you have both handles and handles1 make sure handles1 contains handles to the objects in the figure. If you're using handles1 only, make sure you're initializing it properly.
I have just spet the last few hours trying to find the flag to use in Terminal to launch an app with the colored outlines around the various view elements to show how they are nested. I know that Matt Gemmell covered it during the Cocoa Face Off session of NSConference 2009 (at about the 13minute mark in the video). Unfortunately I can't actually read what he types and he doesn't speak the exact command. I know it has to be in the Apple docs somewhere but the search system is currently not being of any use. It looks like her just adds -showAllViews YES to the end of the command to open TextEdit but that command has no effect in 10.6.6. I have also tried every other capitalization I can think of as well as using view instead of views. Every command opens TextEdit just fine but doesn't show the colored outlines.
Use -NSShowAllDrawing and -NSShowAllDrawingColor:
/Applications/TextEdit.app/Contents/MacOS/TextEdit -NSShowAllDrawing 200 -NSShowAllDrawingColor cycle
-NSShowAllDrawing sets the delay between drawing commands (allowing you enough time to see the drawing update)
-NSShowAllDrawingColor sets the fill colour for the regions with pending drawing operations (see class methods on for NSColor for valid values, or pass it "cycle" to loop through all available colours).
If I have the handles to two windows, how can I tell whether one is obscuring the other? Obviously I can easily do a collision test, but how do I test / find out their "z order"? The windows are from totally different apps.
I am probably missing something fairly obvious..
WindowFromPoint, (use a point bounded by one window, and see if you get back that window's handle, or the other one).
For partial obscuration, you can use the clipping system. I discuss this in more detail on my website here
This page talks about the Z ordering of windows. It doesn't mention a function to get the Z order directly, but it does point at GetNextWindow(), which given one window can return the next (or previous, don't let the name fool you) in the Z order. Using that, you should be able to figure it out.