Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts

Friday, 16 November 2012

Finding out what Matlab tooboxes are available for use

Finding out what toolboxes are available to a Matlab installation is actually relatively simple - it's just a case of typing:
 ver  

at the Matlab prompt.

On it's own, however, this function doesn't supply much useful information, as it doesn't tell you what licences are available to the installation, and hence which toolboxes you can actually use (which is probably what you care about when you're trying to find out what toolboxes are available).

It is possible to find out what licenses are available to the installation, however it takes a bit more work.

First, we need to define a feature string, which is just a list of all the toolboxes potentially installed:
 featureStr = {'Aerospace_Blockset'; ...  
        'Aerospace_Toolbox'; ...  
        'Bioinformatics_Toolbox'; ...  
        'Communication_Blocks'; ...  
        'Communication_Toolbox'; ...  
        'Compiler'; ...  
        'Control_Toolbox'; ...  
        'Curve_Fitting_Toolbox'; ...  
        'Data_Acq_Toolbox'; ...  
        'Database_Toolbox'; ...  
        'Datafeed_Toolbox'; ...  
        'Dial_and_Gauge_Blocks'; ...  
        'Distrib_Computing_Toolbox'; ...  
        'Econometrics_Toolbox'; ...  
        'EDA_Simulator_Link_DS'; ...  
        'Embedded_Target_c166'; ...  
        'Embedded_Target_c2000'; ...  
        'Embedded_Target_c6000'; ...  
        'Embedded_Target_MPC555'; ...  
        'Excel_Link'; ...  
        'Filter_Design_HDL_Coder'; ...  
        'Filter_Design_Toolbox'; ...  
        'Fin_Derivatives_Toolbox'; ...  
        'Financial_Toolbox'; ...  
        'Fixed_Income_Toolbox'; ...  
        'Fixed_Point_Toolbox'; ...  
        'Fixed-Point_Blocks'; ...  
        'Fuzzy_Toolbox'; ...  
        'GADS_Toolbox'; ...  
        'IDE_Link_MU'; ...  
        'Identification_Toolbox'; ...  
        'Image_Acquisition_Toolbox'; ...  
        'Image_Toolbox'; ...  
        'Instr_Control_Toolbox'; ...  
        'Link_for_Incisive'; ...  
        'Link_for_ModelSim'; ...  
        'Link_for_Tasking'; ...  
        'Link_for_VisualDSP'; ...  
        'MAP_Toolbox'; ...  
        'MATLAB'; ...  
        'MATLAB_Builder_for_dot_Net'; ...  
        'MATLAB_Builder_for_Java'; ...  
        'MATLAB_Distrib_Comp_Engine'; ...  
        'MATLAB_Excel_Builder'; ...  
        'MATLAB_Link_for_CCS'; ...  
        'MATLAB_Report_Gen'; ...  
        'MBC_Toolbox'; ...  
        'MPC_Toolbox'; ...  
        'NCD_Toolbox'; ...  
        'Neural_Network_Toolbox'; ...  
        'OPC_Toolbox'; ...  
        'Optimization_Toolbox'; ...  
        'PDE_Toolbox'; ...  
        'Power_System_Blocks'; ...  
        'Real-Time_Win_Target'; ...  
        'Real-Time_Workshop'; ...  
        'RF_Blockset'; ...  
        'RF_Toolbox'; ...  
        'Robust_Toolbox'; ...  
        'RTW_Embedded_Coder'; ...  
        'Signal_Blocks'; ...  
        'Signal_Toolbox'; ...  
        'SimBiology'; ...  
        'SimDriveline'; ...  
        'SimElectronics'; ...  
        'SimEvents'; ...  
        'SimHydraulics'; ...  
        'SimMechanics'; ...  
        'Simscape'; ...  
        'SIMULINK'; ...  
        'Simulink_Control_Design'; ...  
        'Simulink_Design_Verifier'; ...  
        'Simulink_HDL_Coder'; ...  
        'Simulink_Param_Estimation'; ...  
        'SIMULINK_Report_Gen'; ...  
        'SL_Verification_Validation'; ...  
        'Spline_Toolbox'; ...  
        'Stateflow'; ...  
        'Stateflow_Coder'; ...  
        'Statistics_Toolbox'; ...  
        'Symbolic_Toolbox'; ...  
        'SystemTest'; ...  
        'Video_and_Image_Blockset'; ...  
        'Virtual_Reality_Toolbox'; ...  
        'Wavelet_Toolbox'; ...  
        'XPC_Embedded_Option'; ...  
        'XPC_Target'};  

That's a lot of typing, so I'd just copy and paste from above, into your Matlab prompt.

Next, we want to check that licenses exist for each of the items in the above list:
 index = cellfun(@(f) license('test',f),featureStr);  
 availableFeatures = featureStr(logical(index));  

Licences that exist are now stored in availableFeatures, so typing that at the prompt gives us a list of licences that are available to the installation:
 availableFeatures  

To see if a single license exists, we can also simply supply license('test',<feature_name>) with the single feature string we care about. For example:
 license('test', 'Neural_Network_Toolbox')  

This is normally as much information as we need, but if we need to know if a licence is available to checkout at the present time, we can continue as below.

NB: Using license('checkout',<license>), as described below, is not normally a good idea when using network licences, as the license will not be released until Matlab is shut down. Usually, licenses are checked out automatically, as and when they are required by a toolbox.

So far, we've found out whether or not a license exists, but not if one is presently available for us to check out. To actually checkout a license, such as the Signal Toolbox, we can do:
 license('checkout','Signal_Toolbox')  
Where Signal_Toolbox comes for the feature string list at the top of this post.

If Matlab returns:
 ans = 1  

Then the license checkout was successful. We can also look at the licenses we currently have checked out out using:
 license('inuse')  

As usual, I hope this has been helpful, and feel free to add any notes or observations in the comments below.

References:

  1. Matlab documentation: license()
  2. Matlab newsgroup: License checking
  3. StackOverflow: How would one check for installed MATLAB toolboxes in a script/function?


Thursday, 19 July 2012

Mounting an executable CD Drive in Linux

I ran into the below problem while installing Matlab onto a Linux machine. Hopefully this will help someone else!

On most modern Linux systems, CD drives are automatically mounted. The problem comes when they are mounted without any exec permissions - this means that any scripts, etc on the CD, or .iso, will be unable to run. To resolve this, follow the steps below:
  1. Find the name of your mounted CD drive by using:
     mount  
    
  2. Then remount the device with the exec bit set:
     mount -o remount,exec $DEVICE
Where $DEVICE is the name of the CD drive.

You'll then be able to run all executables on the drive - in my case, the Matlab executable was then launched using the below commands:
 $ su  
 $ /path/to/mounted/cdrom/./install  

Remember to logout as root when the installer has finished!
 logout