Auto complete filename and filepath - append

5 vues (au cours des 30 derniers jours)
Pradeep Chandran
Pradeep Chandran le 16 Mai 2021
Hi,
I do not know the file name at the time of coding. As I get data, it will be stored as "user.txt" Now I need to fill in my code the path and the filename once. Now I shall read the file, process it and save many output files as "useroutput.txt", "useroutput.jpg", and so on. in the same path as the data file. I don't want to keep editing each and every place and time.
How can I do this? Any help is appreciated. Thank you for your time.

Réponses (2)

KSSV
KSSV le 16 Mai 2021
for i = 1:10
txtFile = strcat('user_',num2str(i),'.txt') ;
imageFile = ['userImage_',num2str(i),'.jpeg'] ;
% save using the file names
end

Pradeep Chandran
Pradeep Chandran le 16 Mai 2021
Modifié(e) : Pradeep Chandran le 17 Mai 2021
Thank you KSSV,
I have something in my mind like this...
FileId: %enter your filename
PathId: %enter your path to the file
Textread('pathId/fileId',%f')
...
fopen('pathId/fileId+output.txt','w')
...
exportgraphics('pathId/fileId+output.jpg')
Is it possible to this in matlab?

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by