MATLAB: set title of non-java command window -


question

how set command window title matlab window launched without desktop , without java?

  • matlab ver of primary interest: 2012a & later
  • os needed: windows (xp) primarily; more general preferred
  • ideal solution: sets title in resulting window produced "mat" function described below.
  • alternate solution: set command window title in window produced "matj" function described below.

background

i have anonymous functions launch "barebones matlab" windows (each executing main matlab window's terminal.

mat  = @(scmd) system(['matlab.exe -nodesktop -nosplash -nojvm -r "' scmd ';" &']); matj = @(scmd) system(['matlab.exe -nodesktop -nosplash -r "' scmd ';" &']); 

the "matj" window more ram-memory intensive produced "mat".

i aware of techniques set title in java-enabled windows, such following (which, curiously, did not work in "matj" window):

cmdtitle = @(st) com.mathworks.mde.desk.mldesktop.getinstance.getclient('command window').gettoplevelancestor.settitle(st) 

why need this/what i'm doing this

i divvy memory-intensive non-plotting matlab tasks these barebones-windows "master" matlab window (fully loaded java & other bells/whistles). setting title these allow me give them visual tag regarding window's assigned task.

also, helpful able expand displayed-text buffer in these barebones windows (it seems they're limited ~500 lines on computer). work-around title-setting issue display string terminal once barebones window displays, limited buffer prevents first line persisting.

suggestions on better/alternate ways achieve these objectives appreciated, time in reading/answering. thank & day.

by sounds of doing akin batch processing. may want matlab parallel computing toolbox. more recent versions of & matlab allow treat computer mini compute-cluster , fire off batch jobs solve problem neatly.

alternatively, if haven't got license go windows api route setting window title, , wrap in mexfunction. since interesting have hacked code this:

//include windows api functions #include <windows.h> //include matlab mex function stuff #include "mex.h"  dword processid; //the process id of current matlab  //callback function, bit sets window text bool callback settitleenum( hwnd hwnd, lparam lparam ) {         dword dwid ;     //get process of window called on     getwindowthreadprocessid(hwnd, &dwid);      //if our matlab instance, set title text     if(dwid == processid) setwindowtext(hwnd, (const char*) lparam);     return true; }  void mexfunction(int nlhs, mxarray *plhs[], int nrhs, const mxarray *prhs[])  {     //get process id of instance of matlab     processid = getcurrentprocessid();       if (nrhs > 0) { //if have been given title         char * title = mxarraytostring(prhs[0]); //get char* string              //get open windows , call settitleenum function on them         enumwindows((wndenumproc)settitleenum, (lparam) title);                 mxfree(title);//free title string.     } } 

i compiled above code in matlab using visual studio 2010 express , worked fine me, both in restricted command line version , normal full desktop matlab.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -