Cody

Problem 42770. Create formatted value string Cell array of a vector

Created by Richard Zapor in Community

This Challenge is to create a cell array that contains strings of vector components in a given format.

c=vector2formattedstringCA(fmt,v)

Example:

fmt='%.3f'; v=[-3.1416 -1.5708 0 1.5708  3.1416]
c={ '-3.142'    '-1.571'    '0.000'    '1.571'    '3.142'}

References:

I observed an intriguing function usage by LY Cao and googled it to Undocumented Matlab .

Solution Stats

70.37% Correct | 29.63% Incorrect
Last solution submitted on Nov 20, 2018