How do I import a data file as a matrix and run a .m file from a python script?
古いコメントを表示
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?
採用された回答
その他の回答 (2 件)
Mallory
2013 年 12 月 25 日
5 件のコメント
Mallory
2013 年 12 月 25 日
Walter Roberson
2013 年 12 月 25 日
Inside NN_v1.m you would have
NNInput = load('NNinput');
NNinputSiAvg340 = load('NNinputSiAvg340');
NNoutput = load('NNoutput');
followed by configuring and training and whatever-else using those three matrices.
Mallory
2013 年 12 月 25 日
Mallory
2013 年 12 月 25 日
Walter Roberson
2013 年 12 月 25 日
No, that should work fine in Linux.
You can redirect output using the standard ">" redirection, if you want.
What are you seeing when you try this above ?
Mallory
2013 年 12 月 25 日
1 件のコメント
Walter Roberson
2013 年 12 月 25 日
Better would be
os.system("matlab -nodisplay -r 'try NN_v1; catch me; end; quit'")
When you redirect from a script, sometimes you end up with MATLAB endlessly asking for more input. And the try/catch/quit helps in case something goes wrong with the script.
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!