日常应用基础操作+常用问题总结

一、Matlab并行处理操作总结

1.1 Matlab并行处理——parfor使用方法:

parfor使用教程地址

 

Matlab错误提示:

Non-singleton dimensions of the two input arrays must match each
other.

解决方案:

Usually

dbstop if error

 helps to reveal such problems. Then Matlab stops, when the error occurs and you can inspect the current dimensions of the variables.

 Classification of Variables in parfor-Loops

 

parfor循环使用时候,首先需要验证for循环的正确性,然后再开启parfor循环。

首先验证程序的正确性,再加速。

 

1.2 Matlab大占比数据量处理

Matlab在处理数据量特别大的数据时(~40G mat文件),如果一次性直接读入会特别占内存,对于机器是一种非常大的负担,而且matlab的计算性能也有限,所以一种比较好的处理方式就是读取部分数据进行处理(如果只是顺序处理数据,并不需要一次性把所有数据读入再进行操作)。

1. Load part of mat data:

Load Parts of Variables from MAT-Files

example = matfile('example.mat');
[nrows, ncols] = size(example,'B');
varlist = who(matObj)

使用size函数可以得到example文件中变量B的大小,注意: 这里不能使用length函数,使用length函数会将example.B变量全部加载进来,会造成很大的资源损耗。

Matlab在使用matfile读入 example.mat 文件时,已经读入了该文件的基本信息,只是未读入数据信息。

 

其它参考资料:

matlab.io.MatFile class

 

2. save part of mat file

Save Parts of Variables to MAT-Files

example = matfile('example.mat','Writable',true)
example.B(1,:) = 2 * example.B(1,:);

 

 

二、pycharm导入工程之后包处理

在pycharm里面打开项目之后,如果没有设置好工程对应的PYTHONPATH,那么项目中的package相互依赖关系可能会出现问题。因此在导入后需要设置。

Unresolved reference issue in PyCharm

 

设置方法见地址:

Unresolved reference issue in PyCharm

并不是要把项目文件设为srcpath,而是需要将用的包的上级目录设置为PYTHONPATH,python在进行搜索时,不会进行迭代搜索,因此将包含package1,package2的上级目录lib设为srcPath,即可解决。

 附:python module tutorial

 

三、PPT制作模板网站:

slidescarnival

posted @ 2016-05-25 20:36  Fight boy  阅读(785)  评论(0编辑  收藏  举报