MATLAB Answers

index in safe-title

조회 수: 1(최근 30일)
Lukas Netzer
Lukas Netzer 2021년 5월 6일
댓글: Lukas Netzer 2021년 5월 10일
I would like to define my file with the title, so that includes the according index. I tried:
saveas(gcf,'title', t{n},'jpeg')
Either wont work - is there a way?
Thanks in advance!

채택된 답변

Steven Lord
Steven Lord 2021년 5월 6일
str = "title_" + t{n}
This will attempt to convert t{n} into a string and concatenate the string "title_" and that newly created string. I've defined it as a separate variable so you can see what it looks like. If this doesn't do what you want, show us the value of str that is displayed when you run this code and describe how it differs from how you want it to look.
  댓글 수: 1
Lukas Netzer
Lukas Netzer 2021년 5월 10일
thank you!!

댓글을 달려면 로그인하십시오.

추가 답변(1개)

KSSV 2021년 5월 6일
  댓글 수: 4
Walter Roberson
Walter Roberson 2021년 5월 6일
What datatype is t{n} ? If it is numeric then
filename = sprintf('title_%g.jpg', t{n});
saveas(gcf, filename, 'jpeg')

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by