How to add a .mat file (including the file path) to a specific location in a Python script and save this Python script using matlab?
    2 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    sachin k p
 am 26 Aug. 2018
  
    
    
    
    
    Bearbeitet: sachin k p
 am 2 Sep. 2018
            Is it possible to add a .mat file location to a specific location in a Python script and save this Python script using MATLAB
0 Kommentare
Akzeptierte Antwort
  Kenny Shu
    
 am 28 Aug. 2018
        You can write directly to the Python script using "fprintf":
 replaceLine = 2
 fid = fopen('mypyfile.py', 'r+');
 for k=1:(replaceLine-1);
     fgetl(fid);
 end
 fseek(fid, 0, 'cof');
 fprintf(fid,'print("%s")','myMAT.mat')
 fclose(fid)
Refer to the following link for additional information on writing data to text files:
Consider writing the MAT file location to an intermediate medium (such as a text file or database) in MATLAB and reading from that medium in Python.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

