How to loop strings
1 次查看(过去 30 天)
显示 更早的评论
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"
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!