Addressing variables with special characters in the name

조회 수: 11 (최근 30일)
Edward Robinson
Edward Robinson 2021년 2월 17일
댓글: Walter Roberson 2023년 9월 16일
Hi,
I have some .mat files generated by an external program which have some variables with a percentage sign in them. Is there any way at all to address these variables within matlab, really just to rename them to something without the special character?
i.e change nnnn% to nnnn
Many thanks

답변 (2개)

Walter Roberson
Walter Roberson 2021년 2월 17일
편집: Walter Roberson 2023년 9월 16일
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 9월 16일
(I tried it a couple of months ago, around April 2023, and it still worked.)

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


dpb
dpb 2023년 9월 16일
A brute-force, dead-ahead solution is at <Fix .mat file variable names>. It's simply string substitution...as @Walter Roberson notes, the new variable name must be the same length as the original to not corrupt the file; that is you must substitute in a valid character in place of the invalid one, you can't just eliminate it, thereby shortening the name.

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by