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


Python Matlab.run方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pymatbridge import Matlab [as 别名]
# 或者: from pymatbridge.Matlab import run [as 别名]
class MatlabCaller:
    """
    bridging class with matlab
    """

    def __init__(self, port=14001, id=None):
        if id is None:
            id = numpy.random.RandomState(1234)

        # Initialise MATLAB
        self.mlab = Matlab(port=port, id=id)

    def start(self):
        # Start the server
        self.mlab.start()

    def stop(self):
        self.mlab.stop()
        os.system('pkill MATLAB')


    def call_fn(self, path=None, params=None):
        """
        path: the path to your .m function
        params: dictionary contains all parameters
        """
        assert path is not None
        assert isinstance(params, dict)

        return self.mlab.run(path, params)['result']
开发者ID:xiaoyili,项目名称:xylearn,代码行数:32,代码来源:bridge_util.py

示例2: Matlab

# 需要导入模块: from pymatbridge import Matlab [as 别名]
# 或者: from pymatbridge.Matlab import run [as 别名]
from pymatbridge import Matlab
mlab = Matlab(matlab='/Applications/MATLAB_R2014a.app/bin/matlab')
mlab.start()
res = mlab.run('/Users/yanguango/Lab/SpamFilter/Project/src/PCA.m', {'arg1': 3, 'arg2': 5})
print res['result']
开发者ID:yanguango,项目名称:spam_filter,代码行数:7,代码来源:test.py

示例3: pixels

# 需要导入模块: from pymatbridge import Matlab [as 别名]
# 或者: from pymatbridge.Matlab import run [as 别名]
            scaled_for_color = math.ceil(32 * pixel_normalized_val + 32)
            if scaled_for_color == 0:
                scaled_for_color = 1
            group["intelligent_icon"][row][column] = scaled_for_color
    if add_struct_comma_to_expr:
        matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + "," 
    else:
        add_struct_comma_to_expr = True   
    matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + "struct('title', '" + group_name + "', 'patches', ["
    add_pixel_comma_to_expr = False
    #flatten the bitmap into a vector of pixels (see matlab/show_icons.m)
    for row in range(row_pixel_count):
        for column in range(row_pixel_count):
            if add_pixel_comma_to_expr:
                matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + ","
            else:
                add_pixel_comma_to_expr = True 
            matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + str(group["intelligent_icon"][row][column])
    matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + "])"
matlab_intelligent_icon_visualization_data_expr = matlab_intelligent_icon_visualization_data_expr + "]"

print("rendering intelligent icon grid")
#initialise matlab bridge
mlab = Matlab(port=4000, matlab=matlab_path)
mlab.start()
#i cant imagine more ghetto way to do this, but it seems to be the only way to pass this data through some bug in the data parsing part of the bridge (Which i didnt write, for the record!!!)
icon_data_expr_encoded = base64.b64encode(matlab_intelligent_icon_visualization_data_expr)
print(icon_data_expr_encoded)
mlab.run(base_dir + "/matlab/show_icons.m", {"encoded": icon_data_expr_encoded})

print("done without errors")
开发者ID:pvnick,项目名称:tardis,代码行数:33,代码来源:analyze.py

示例4: Matlab

# 需要导入模块: from pymatbridge import Matlab [as 别名]
# 或者: from pymatbridge.Matlab import run [as 别名]
'''
Created on 25 sep 2015

@author: fragom
'''
from pymatbridge import Matlab

if __name__ == '__main__':
    mlab= Matlab(matlab='C:/Program Files/MATLAB/R2012b/bin/matlab.exe')
    mlab.start()
    for i in range(10):
        print mlab.run('C:/IDE/python-matlab-bridge/test.m',{'a':i})['result']
    mlab.stop()
开发者ID:MaximeBaudette,项目名称:ScriptMAE,代码行数:15,代码来源:joke_pymatbridge.py


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