如何将数据文件作为矩阵导入并从python脚本运行.m文件? [英] How do I import a data file as a matrix and run a .m file from a python script?

查看:221
本文介绍了如何将数据文件作为矩阵导入并从python脚本运行.m文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.m文件,该文件用于在matlab中运行神经网络,该文件已本地安装在计算机上.我正在尝试编写一个Python脚本,该脚本将多次遍历神经网络可能的传递和训练功能的列表.我已经编写了一个打开和编辑.m文件的功能,但是我不知道如何操作. 1.从python脚本运行.m文件.2.将神经网络所需的数据导入为空格分隔的矩阵.

I have a .m file that is used to run a neural network in matlab, which I have locally installed on my computer. I am trying to write a python script that will loop through a list of possible transfer and training functions for the neural network multiple times. I've written a function to open and edit the .m file, but I don't know how to; 1. run the .m file from the python script 2. import the necessary data for the neural network as a space delimited matrix.

我有三个需要作为矩阵导入的数据文件,代码是什么样的?

I have three data files that need to be imported as matrices, what would the code look like?

推荐答案

\'\'之间的部分是MATLAB代码.这可以帮助您使用输入参数运行MATLAB代码.如果不需要日志文件中的输出,请取消注释logfile = '/dev/null'.

The part between \' and \' is MATLAB code. This could help you to run your MATLAB code with input arguments. Uncomment logfile = '/dev/null', if you do not need the output in the logfile.

这篇关于如何将数据文件作为矩阵导入并从python脚本运行.m文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆