Borrar filtros
Borrar filtros

How to change a given name

2 visualizaciones (últimos 30 días)
Dion Theunissen
Dion Theunissen el 9 de Feb. de 2021
Comentada: Stephen23 el 9 de Feb. de 2021
An easy question but I can not find the solution. I have a number which is changing but i want to change it by myself.
How can I use that one in my folder name like this:
Thanks in advance
%% test
num = '0000060'
folder = 'C:\Users\dit\Documents\MATLAB\RawData\'+ num +'.csv';

Respuesta aceptada

KSSV el 9 de Feb. de 2021
Editada: KSSV el 9 de Feb. de 2021
Also read about strcat.
%% test
num = '0000060'
num = '0000060'
folder = ['C:\Users\dit\Documents\MATLAB\RawData\',num,'.csv']
folder = 'C:\Users\dit\Documents\MATLAB\RawData\0000060.csv'

Más respuestas (1)

Jan el 9 de Feb. de 2021
num = '0000060'
folder = ['C:\Users\dit\Documents\MATLAB\RawData\', num, '.csv'];
% Or with strings instead of char vectors:
folder = "C:\Users\dit\Documents\MATLAB\RawData\" + num + ".csv";
% Or:
num = 60
folder = fullfile('C:\Users\dit\Documents\MATLAB\RawData\', ...
sprintf('%07d.csv', num))
  1 comentario
Stephen23 el 9 de Feb. de 2021
+1 sprintf is the way to go.

Iniciar sesión para comentar.


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




Community Treasure Hunt

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

Start Hunting!

Translated by