MATLAB Macro for Clustering DSMs

DSM_MatLab.zip
MatLabAlgorithm to cluster DSMs by Ronnie Thebeau
26 K
MSc_Thebeau.pdf
Documentation of the algorithm in the Masters thesis by Ronnie Thebeau, MIT, 2001, non-printable
8.7 M

You don’t have to be a MatLab whiz to run these macros; unfortunately, you have to have MatLab software in order to run these macros. This file contains several MATLAB macros, all of which are necessary for proper running of the clustering algorithm.

To run the clustering routines:

If you know some MatLab:

  • Create the DSM using the same format as in ‘elevator_DSM’ file. Edit the file or create a new one with the same variable names.

  • Edit the file ‘run_cluster_A’ or create a similar file. Be sure to enter the appropriate DSM file name that was created in step 1. Set clustering variables and plotting variables.

  • If cluster analysis is desired, edit and run the file ‘likeness_calc’.


if you do not know MatLab: 

Hint: everything written in orange below, are the MatLab commands that you will be typing

  • Start MatLab

  • Enter the size of your DSM to be clustered by typing at the Matlab prompt: DSM_size = 20 (20 is just an example. You should enter your own number).

  • Use Excel to build the DSM. Make sure that the Excel DSM contains no empty cells. That is, the DSM should have only “zeros” and “ones”. All diagonal elements in the DSM should be “ones”. In the column next to the last column in your DSM place “semicolons” (;) in all the cells until you reach the last row of the DSM. In that cell place a  “closing square bracket” ( ] ).

  • Highlight the body of the matrix only along with the last column that contains the semicolons and the square bracket (Make sure you do not include any DSM labels or names). Copy the highlighted portion of your DSM.

  • Go to MatLab and type the following: DSM = [          (DO NOT PUSH ENTER YET)

  • Then, paste from Excel sheet your DSM. Now Push ENTER.

  • Now we need to enter the labels of the elements in your DSM. We do that by entering them one at a time as follows – at the MatLab prompt type. Note that the names between the single quotes in the lines below are just an example. You need to enter your own names but using exactly the same format as shown. So, you will have as many lines as you have DSM elements, plus one extra line (for the first command in the beginning). Type:


      DSMLABEL = cell(DSM_size,1);

      DSMLABEL{1,1} = ‘Hall Request Indicator’;

      DSMLABEL{2,1} = ‘Car Request Indicator’;

      DSMLABEL{3,1} = ‘Hallway Fixtures’;

      DSMLABEL{4,1} = ‘Car Fixtures’;

      DSMLABEL{5,1} = ‘Emerg. Intercom-Phone’;

      DSMLABEL{6,1} = ‘Car Buttons’;

      DSMLABEL{7,1} = ‘Hall Buttons’;

      DSMLABEL{8,1} = ‘Firemans Service key’;

      DSMLABEL{9,1} = ‘Travelling Comm. Cable’;

  • If you want to identify and extract system elements form the DSM, so that they will not be considered in the clustering, then type: extract_elements = [5,7,10] where you list number of each element you want to be excluded, separated by commas. IF no elements need to be extracted, then just type: extract_elements = [ ]
  • Next go to the “FILE” pull-down menu and select “Run Script…” 

  • A pop up window appears, click on “Browse” and select the file ‘run_cluster_B’ in whatever directory (i.e. path) you have saved it. Push enter.