Effacer les filtres
Effacer les filtres

Read m-file from another file

2 vues (au cours des 30 derniers jours)
saima
saima le 12 Mai 2012
Commenté : Juan Espinosa le 8 Nov 2017
Hello,
I am doing a thesis. I am going to describe my problem briefly. I need to make an m-file that can take another m-file as input, read it and do some modifications in that file as instructed. How can i do that job of reading?
-Saima
  1 commentaire
Juan Espinosa
Juan Espinosa le 8 Nov 2017
This could have helped you :(
https://www.mathworks.com/matlabcentral/answers/63149-passing-functions-and-m-files-to-functions
Cheers

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 12 Mai 2012
Use fopen(), fgets() or fgetl(), and fprintf() and fclose(). With that you can open any text file, such as an m-file, change the text however you want, and write it back out.
  2 commentaires
Soni huu
Soni huu le 4 Juil 2012
Modifié(e) : Walter Roberson le 14 Juil 2012
can u show sample code if my m file in c:\work
m file 1 is the code to identification of data xxx.dat (9 cell)
m file 2 is read m file 1 and [sum cell 4 (cac{4})]/60
thanks..
if normal way.. i must write :
a=sum(cac{4});
ax=a/60
Image Analyst
Image Analyst le 5 Juil 2012
I don't understand what you said.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by