How to change a given name

2 visualizzazioni (ultimi 30 giorni)
Dion Theunissen
Dion Theunissen il 9 Feb 2021
Commentato: Stephen23 il 9 Feb 2021
Hi,
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';

Risposta accettata

KSSV
KSSV il 9 Feb 2021
Modificato: KSSV il 9 Feb 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'

Più risposte (1)

Jan
Jan il 9 Feb 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))

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by