coreComponents
Class MatlabUtils

java.lang.Object
  |
  +--coreComponents.MatlabUtils

public class MatlabUtils
extends java.lang.Object

A very messy class used to store functions that are useful producing/working with Matlab.

Version:
$Revision: 1.0 $
Author:
David Lindsay (davidl@cs.rhul.ac.uk)

Constructor Summary
MatlabUtils()
           
 
Method Summary
static java.lang.String commentOutText(java.lang.String text)
          This is a stupid function that puts in Matlab comments into a region of text.
static void createMatlabMatrixFile(java.lang.String comments, Instances data, java.lang.String filename)
          Output instances as simple matlab matrix file
static void plotInstancesAsMatlabLineGraph(java.lang.String comments, java.lang.String title, java.lang.String yAxisLabel, java.lang.String xAxisLabel, Instances data, java.lang.String filename, java.lang.String xAxisAttName)
          Useful function for plotting the a data set of instances as a Matlab line graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatlabUtils

public MatlabUtils()
Method Detail

createMatlabMatrixFile

public static void createMatlabMatrixFile(java.lang.String comments,
                                          Instances data,
                                          java.lang.String filename)
Output instances as simple matlab matrix file

Parameters:
comments - the comments to be put into the file
data - the data to be output
filename - the filename to create

plotInstancesAsMatlabLineGraph

public static void plotInstancesAsMatlabLineGraph(java.lang.String comments,
                                                  java.lang.String title,
                                                  java.lang.String yAxisLabel,
                                                  java.lang.String xAxisLabel,
                                                  Instances data,
                                                  java.lang.String filename,
                                                  java.lang.String xAxisAttName)
Useful function for plotting the a data set of instances as a Matlab line graph. Each attribute is treated as a different line on the graph. The attribute names are used as the legends for each line.

Parameters:
comments - string used to describe experiment this will be commented out
title - the tile of the line plot
yAxisLabel - the name that you want to give the y-axis on the plot
xAxisLabel - the name that you want to give the x-axis on the plot
data - the instances to be plotted
filename - the filename (with directory path) to call the matlab '.m' file
xAxisAttName - string name of the attribute in the data which will be used for the x-axis

commentOutText

public static java.lang.String commentOutText(java.lang.String text)
This is a stupid function that puts in Matlab comments into a region of text. It looks for carriage returns so that it can insert comments for each new line.

Parameters:
text - the text to be converted
Returns:
the text with added comments.


Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London