Filter löschen
Filter löschen

how to precise the number of digits in MATLAB?

1 Ansicht (letzte 30 Tage)
ihssane houhou
ihssane houhou am 5 Dez. 2018
Kommentiert: ihssane houhou am 5 Dez. 2018
hi guys
I want to save some images in a folder from matlab using imwrite(), and I want to name them by counting, which means each image will be named by two letters and six digits such as (gt000001, gt000002, gt000003, gt000004, ..., gt001457, ... ,gt200000).
could someone help me do that?

Akzeptierte Antwort

Rik
Rik am 5 Dez. 2018
You can generate a name like that with the sprintf function:
number=2;
name=sprintf('gt%06d',number);
  2 Kommentare
madhan ravi
madhan ravi am 5 Dez. 2018
+1 exactly!
ihssane houhou
ihssane houhou am 5 Dez. 2018
thank you, it worked very well.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by