I want to convert a string to .m file

조회 수: 4 (최근 30일)
Osama Alkurdi
Osama Alkurdi 2020년 2월 2일
댓글: Osama Alkurdi 2020년 2월 2일
ex: (for understand what I mean clearly)
if I have a string stored in some variable
let's say y="x=sin(pi)";
I want matlab to create a .m file with a certain name a save that string in it
so, the string will be a command line in that .m fileCapture.PNG
  댓글 수: 4
Osama Alkurdi
Osama Alkurdi 2020년 2월 2일
@stozaki
yes, but I want to excute it from .m file
Osama Alkurdi
Osama Alkurdi 2020년 2월 2일
@Sridhar SG 8
no

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

채택된 답변

stozaki
stozaki 2020년 2월 2일
편집: stozaki 2020년 2월 2일
Please try following script. (attached .m file)
y="x=sin(pi)";
eval (y)
eval execute MATLAB expression in text.
Regards,
stozaki

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by