当前位置: 首页>>代码示例>>Java>>正文


Java MatFileReader.getContent方法代码示例

本文整理汇总了Java中com.jmatio.io.MatFileReader.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java MatFileReader.getContent方法的具体用法?Java MatFileReader.getContent怎么用?Java MatFileReader.getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jmatio.io.MatFileReader的用法示例。


在下文中一共展示了MatFileReader.getContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
	// MLCell cell = new MLCell("data", new int[]{100000,1});
	// Random r = new Random();
	// for (int i = 0; i < 100000; i++) {
	// MLCell inner = new MLCell(null, new int[]{2,1});
	// inner.set(new MLChar(null,"Dummy String" + r.nextDouble()), 0, 0);
	// MLDouble d = new MLDouble(null, new double[][]{new
	// double[]{r.nextDouble()}});
	// inner.set(d, 1, 0);
	// cell.set(inner, i,0);
	// }
	// ArrayList<MLArray> arr = new ArrayList<MLArray>();
	// arr.add(cell);
	// new MatFileWriter( "mat_file.mat", arr);
	final MatFileReader reader = new MatFileReader("/Users/ss/Development/python/storm-spams/XYs.mat");
	final Map<String, MLArray> content = reader.getContent();
	final MLCell cell = (MLCell) content.get("XYs");
	System.out.println(cell.get(0, 0));
	System.out.println(cell.get(0, 1));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:MatlabIO.java

示例2: before

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
/**
 * Before
 * 
 * @throws IOException
 */
@Before
public void before() throws IOException {
	final MatFileReader reader = new MatFileReader(TestFewEigenvalues.class.getResourceAsStream("test_eig.mat"));
	final Map<String, MLArray> content = reader.getContent();
	L = fromMLArray((MLDouble) content.get("L"));
	fromMLArray((MLDouble) content.get("evec"));
	eval = fromMLArray(((MLDouble) content.get("eval"))).column(0);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:14,代码来源:TestFewEigenvalues.java

示例3: BillMatlabFileDataGenerator

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
/**
 * @param matfile
 * @param ndays
 * @param filter
 * @throws IOException
 */
public BillMatlabFileDataGenerator(File matfile, int ndays, boolean filter)
		throws IOException
{
	final MatFileReader reader = new MatFileReader(matfile);
	this.ndays = ndays;
	this.content = reader.getContent();
	this.currentIndex = 0;
	this.filter = filter;
	prepareVocabulary();
	prepareFolds();
	prepareDayUserWords();
	prepareDayPolls();

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:BillMatlabFileDataGenerator.java

示例4: testFilteredReading

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
/**
 * Tests filtered reading
 * 
 * @throws IOException
 */
@Test 
public void testFilteredReading() throws IOException
{
    //1. First create arrays
    //array name
    String name = "doublearr";
    String name2 = "dummy";
    //file name in which array will be storred
    String fileName = "filter.mat";
    File outFile = temp.newFile( fileName );
    
    double[] src = new double[] { 1.3, 2.0, 3.0, 4.0, 5.0, 6.0 };
    MLDouble mlDouble = new MLDouble( name, src, 3 );
    MLChar mlChar = new MLChar( name2, "I am dummy" );
    
    //2. write arrays to file
    ArrayList<MLArray> list = new ArrayList<MLArray>();
    list.add( mlDouble );
    list.add( mlChar );
    new MatFileWriter( outFile, list );
    
    //3. create new filter instance
    MatFileFilter filter = new MatFileFilter();
    filter.addArrayName( name );
    
    //4. read array form file
    MatFileReader mfr = new MatFileReader( outFile, filter );
    
    //check size of
    Map<String, MLArray> content = mfr.getContent();
    assertEquals("Test if only one array was red", 1, content.size() );
    
}
 
开发者ID:gradusnikov,项目名称:jmatio,代码行数:39,代码来源:MatIOTest.java

示例5: MatlabFileDataGenerator

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
public MatlabFileDataGenerator(File matfile) throws IOException {
	MatFileReader reader = new MatFileReader(matfile);
	Map<String, MLArray> content = reader.getContent();
	this.data= (MLCell) content.get("XYs");
	this.index = 0;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:7,代码来源:MatlabFileDataGenerator.java

示例6: MatlabFileInitStrat

import com.jmatio.io.MatFileReader; //导入方法依赖的package包/类
/**
 * @param matfile the file from which to read
 * @throws IOException
 */
public MatlabFileInitStrat(File matfile) throws IOException {
	MatFileReader reader = new MatFileReader(matfile);
	Map<String, MLArray> content = reader.getContent();
	this.data= CFMatrixUtils.asMat(content.get("arr"));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:10,代码来源:MatlabFileInitStrat.java


注:本文中的com.jmatio.io.MatFileReader.getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。