Read m-file from another file

조회 수: 8 (최근 30일)
saima
saima 2012년 5월 12일
댓글: Juan Espinosa 2017년 11월 8일
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
Juan Espinosa
Juan Espinosa 2017년 11월 8일
This could have helped you :(
https://www.mathworks.com/matlabcentral/answers/63149-passing-functions-and-m-files-to-functions
Cheers

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2012년 5월 12일
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
Soni huu
Soni huu 2012년 7월 4일
편집: Walter Roberson 2012년 7월 14일
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 2012년 7월 5일
I don't understand what you said.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by