Comments on: sprintfc – undocumented helper function https://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function Charting Matlab's unsupported hidden underbelly Mon, 07 Jun 2021 16:25:14 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: How do I make a column vector into an array of strings? - DexPagehttps://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function#comment-352267 Thu, 02 Jul 2015 03:18:07 +0000 https://undocumentedmatlab.com/?p=4419#comment-352267 […] you can use undocumented built-in function sprintfc to convert a numeric array to a cell array of strings like so […]

]]>
By: Class object creation performance | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function#comment-303735 Wed, 11 Dec 2013 16:57:19 +0000 https://undocumentedmatlab.com/?p=4419#comment-303735 […] Matlab application's performance and your Matlab programming skills in general, join my upcoming Advanced Matlab Programming course in London, March 2014 – an intensive 2 day course on best practices, preparing professional […]

]]>
By: Matteohttps://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function#comment-299927 Thu, 28 Nov 2013 17:18:51 +0000 https://undocumentedmatlab.com/?p=4419#comment-299927 Hi Yair

I tried to figure out how to do this, and with higher dimension cell arrays, when I was still a Matlab newbie. I was obviously ahead of myself, but with a ton of reading, testing, and asking around, I managed. But if I needed to do that again it is good to know about this function. Great tip, nice post. Thanks

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function#comment-299842 Thu, 28 Nov 2013 08:59:45 +0000 https://undocumentedmatlab.com/?p=4419#comment-299842 @Yaroslav – ah! makes sense, also correlates with the num2str.m code. I’ve updated the main text accordingly. Thanks :-)

]]>
By: Yaroslav Donhttps://undocumentedmatlab.com/blog_old/sprintfc-undocumented-helper-function#comment-299838 Thu, 28 Nov 2013 08:47:40 +0000 https://undocumentedmatlab.com/?p=4419#comment-299838 Yair hi,
After a short inspection I’ve come to the following conclusion: the third variable, isLeft, is used to indicate whether the output cell-string is left-justified; namely, if the '-' flag is used within the format. For example,

>> [cells, ~, isLeft] = sprintfc('%-8.5g', sqrt(2), false)
cells = 
    '1.4142  '
isLeft =
    1

however,

>> [cells, ~, isLeft] = sprintfc('%8.5g', sqrt(2), false)
cells = 
    '  1.4142'
isLeft =
    0

Sincerely, Yaroslav

]]>