sprintfvecUP

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Text/Strs/Chars/Links
Introduced first in SolidGeometry 5.2, Creation date: 2022-04-07, Last change: 2025-09-15

string format for engineering applications



See Also: num2strUP , sprintfvec

Example Illustration

 missing image of sprintfvecUP(vec,unit,dig,cut0,sep,unitall)

Syntax

si=sprintfvecUP(vec,[unit,dig,cut0,sep,unitall])

Input Parameter

vec: vector with doubles
unit: unit string such as 'mm'
dig: number of digits; default is 2
cut0: if true (default); ending zeros are cut
sep: separator between numbers; default is '/'
unitall: if true (false); all numbers get only a unit if they differ

Output Parameter

si: string of units

Examples


num=[1 2 2.3]/pi/pi/pi
sprintfvecUP(num,'m',2,true,'/',true) % meter, cut zeros, all get units
sprintfvecUP(num,'m',2,true,' x ',false) % only once a unit
num=[1 2 2.3/100]/pi/pi/pi
sprintfvecUP(num,'m',2,true,' x ',false) % all units if units differ




Copyright 2022-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Last html export of this page out of FM database by TL: 2025-09-21