フィルターのクリア

How to use Matlab to rename multiple images names? How to differ between two images have the same number

1 回表示 (過去 30 日間)
How to use Matlab to rename multiple images names? How to differ between two images have the same number, such as car and dog ?
old images name :
car_1_1
tree_2_3
dog_1_2
New names
home _1_1
home_2_3
home_1_2

回答 (1 件)

Shubham Rawat
Shubham Rawat 2020 年 12 月 1 日
Hi Mohamed,
You may create new strings by adding suffix of old strings to "home" and then add first character to distinguish. You can produce code like that
str = ["car_1_1"
"tree_2_3"
"dog_1_2"];
for i=1:3
p = convertStringsToChars(str(i)); % convert string to character array
pref = string(p(1)); %first character to pref
suff = string(p(end-3:end)); %last 4 character to suff
str(i) = strcat("home",suff,pref); %concatinating all
end
Hope this Helps!

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by