Clear Filters
Clear Filters

How to loop strings

1 view (last 30 days)
Thuan
Thuan on 6 Jun 2017
How would
zzsprintf(fmt,vecs.'); % will give me a string that look like the following
"<-0.65,-0.9,-0.2>", @"<-0.23,-0.48,-0.28>", @"<-0.21,-0.5,-0.28>", @"<-0.16,-0.6,-0.3>", @"<-0.19,-0.63,-0.32>", @"<-0.69,-0.74,-0.12>", @"<-0.66,-0.63,-0.30>", @"<0.34,0.11,-0.54>", @"<0.18,-0.60,-0.53>", @"<0.23,0.2,-0.58>", @"<0.42,-0.44,-0.62>", @"<0.43,-0.49,-0.65>", @"<0.25,-0.55,-0.68>", @"<0.45,-0.64,-0.84>", @"<-0.13,-0.56,-0.47>", @"<0.92,-0.80,-0.76>", @"<0.17,-0.62,-0.48>", @"<0.56,-0.98,-0.47>", @"<0.16,-0.85,-0.52>", @"<0.17,-0.85,-0.44>", @"<0.45,-0.89,-0.65>", @"<0.10,-0.56,-0.69>", @"<-0.65,0.68,-0.85>", @"<0.21,-0.63,-0.53>", @"<-0.11,0.76,-0.53>", @"<0.31,-0.46,-0.98>", @"<0.32,-0.51,-0.93>", @"<0.36,-0.58,-0.82>", @"<0.33,-0.66,-0.65>", @"<0.43,-0.56,-0.65>", @
The output I'm hoping to get is set line in front 3 lines of string and set line as displayed below. The case number will change as each irrigation. below is sample of 4 first loop 1st
( "Case1", "Case1", "Node", "Vector", 15, [ @
"Node 270252", "Node 270296" ["<-0.65,-0.9,-0.2>", @
"<-0.23,-0.48,-0.28>", @
"<-0.21,-0.5,-0.28>", @
"<-0.16,-0.6,-0.3>", @])
"Case1", "Displacement", "Nodal", "", @
"Static", ["Node 270252"], "FEM"
2nd
( "Case2", "Case2", "Node", "Vector", 15, [ @
"Node 270252", "Node 270296" ["<-0.16,-0.6,-0.3>", @
"<-0.19,-0.63,-0.32>", @
"<-0.69,-0.74,-0.12>", @])
"Case2", "Displacement", "Nodal", "", @
"Static", ["Node 270252"], "FEM"
3rd
( "Case3", "Case3", "Node", "Vector", 15, [ @
"Node 270252", "Node 270296" ["<-0.66,-0.63,-0.30>", @
"<0.34,0.11,-0.54>", @
"<0.18,-0.60,-0.53>", @])
"Case3", "Displacement", "Nodal", "", @
"Static", ["Node 270252"], "FEM"
4th
( "Case4", "Case4", "Node", "Vector", 15, [ @
"Node 270252", "Node 270296" ["<0.23,0.2,-0.58>", @
"<0.42,-0.44,-0.62>", @
"<0.43,-0.49,-0.65>", @])
"Case4", "Displacement", "Nodal", "", @
"Static", ["Node 270252"], "FEM"

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!