Addressing variables with special characters in the name

8 visualizaciones (últimos 30 días)
Edward Robinson
Edward Robinson el 17 de Feb. de 2021
Comentada: Walter Roberson el 16 de Sept. de 2023
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

Respuestas (2)

Walter Roberson
Walter Roberson el 17 de Feb. de 2021
Editada: Walter Roberson el 16 de Sept. de 2023
  1 comentario
Walter Roberson
Walter Roberson el 16 de Sept. de 2023
(I tried it a couple of months ago, around April 2023, and it still worked.)

Iniciar sesión para comentar.


dpb
dpb el 16 de Sept. de 2023
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.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by