String of matlab script
显示 更早的评论
Hi all,
Can you please help me to understand what does it mean: fprintf('\n%s.%s.%s\n', tt(5:6), tt(3:4), tt(1:2))
I don't know what tt means.... This string is about creation of filelist. I must understand how my script wirks but it's very difficult to me, because I'm not a programmist((((((((((
2 个评论
Sean de Wolski
2011-6-22
What's a progammist? Apparently they've played a lot of poker according to Google.
Alexa Potanina
2011-6-22
采纳的回答
更多回答(1 个)
Arturo Moncada-Torres
2011-6-22
tt must be a string (an array of characters) previously defined in your code. What the code line does is display in console the elements of tt on reverse order and with a dot:
fprintf('\n%s.%s.%s\n', tt(5:6), tt(3:4), tt(1:2));
^ ^ ^ ^ ^ ^
|__|__|________| | |
|__|_________________| |
|___________________________|
Try and run the following:
tt = 'aabbcc';
fprintf('\n%s.%s.%s\n', tt(5:6), tt(3:4), tt(1:2));
You will get the following result in console:
cc.bb.aa
6 个评论
Alexa Potanina
2011-6-22
Paulo Silva
2011-6-22
+1 vote, Arturo answer is very good
Alexa Potanina
2011-6-22
Jan
2011-6-22
+1: Arturo's answer is very *nice*.
Arturo Moncada-Torres
2011-6-23
My pleasure. Thanks to all of you =)
Walter Roberson
2015-9-20
Kiniena comments
Moncada-Torres illustrates how the code works, and gives a simpler code to explain what the code does.
类别
在 帮助中心 和 File Exchange 中查找有关 Just for fun 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!