Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
fmt='%.3f';
v=[-3.1416 -1.5708 0 1.5708 3.1416];
c_exp={ '-3.142' '-1.571' '0.000' '1.571' '3.142'};
assert(isequal(vector2formattedstringCA(fmt,v),c_exp))
ans =
'-3.142' '-1.571' '0.000' '1.571' '3.142' ''
|
2 | Pass |
fmt='%.6f';
v=rand(1,5);
c_exp={};
for data=v
c_exp{end+1} = sprintf(fmt,data);
end
assert(isequal(vector2formattedstringCA(fmt,v),c_exp))
ans =
'0.591905' '0.320736' '0.602418' '0.312307' '0.739418' ''
|
3 | Pass |
fmt='%i';
v=rand(1,10)*100;
c_exp={};
for data=v
c_exp{end+1} = sprintf(fmt,data);
end
assert(isequal(vector2formattedstringCA(fmt,v),c_exp))
ans =
Columns 1 through 5
'2.153626e+00' '8.379304e+00' '2.309294e+01' '7.874592e+01' '5.816933e+01'
Columns 6 through 11
'2.838067e+01' '7.224654e+01' '7.610374e+01' '6.961192e+01' '5.842747e+01' ''
|
2501 Solvers
900 Solvers
486 Solvers
348 Solvers
Duplicate each element of a vector.
518 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!