Addressing variables with special characters in the name
11 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
Walter Roberson
2021-2-17
编辑:Walter Roberson
2023-9-16
1 个评论
Walter Roberson
2023-9-16
(I tried it a couple of months ago, around April 2023, and it still worked.)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!