-2
$\begingroup$

Ok, I created a table

Table[j, {i, 4}, {j, 3}] // TableForm

and the result is fine, from 1-4 in each column. Now, what if I wanted to extend this table into something that looks like this:

Table[{something, Table[{i, j}, {j, 1, 8, 1}]}, {i, 1, 4, 1}] // TableForm

only without that something written in the front of every row. I wrote it because I don't know Mathematica enough to do it any other way. But this second Table is what I want, I want it to look like that, without that "something". It is not a big problem, if I can't get rid of that but I would be happy to...

The other thing is, I want to export it to a .txt or .dat file that would not have all those {{soidn,soig},{ig,irg}} brackets inside.

How can I do that?

$\endgroup$

closed as unclear what you're asking by m_goldberg, MarcoB, Mr.Wizard Jul 21 '15 at 15:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You should really take more care in formatting (and formulating) your questions. You can find some tips on using markdown to format your posts here. $\endgroup$ – dionys Jul 21 '15 at 10:10
  • 1
    $\begingroup$ You really need to develop your basic Mathematica skills. I strongly recommend you study Power Programming with Mathematica by David B. Wagner. You can find out how to download it free by reading this question $\endgroup$ – m_goldberg Jul 21 '15 at 12:11
1
$\begingroup$

What about this:

Table[{"    ", Table[{i, j}, {j, 1, 8, 1}]}, {i, 1, 4, 1}]

which has no "something", and you might also put it in the TableFormif needed. Alternatively you might make a Gridout of it:

 Grid[Table[{"    ", Table[{i, j}, {j, 1, 8, 1}]}, {i, 1, 4, 1}], 
 Dividers -> All]

yielding the following:

enter image description here

As to your second question, what about

    Table[{"", 
  Table[ToString[i] <> "," <> ToString[j], {j, 1, 8, 1}]}, {i, 1, 4, 
  1}]

(*   {{"", {"1,1", "1,2", "1,3", "1,4", "1,5", "1,6", "1,7", 
   "1,8"}}, {"", {"2,1", "2,2", "2,3", "2,4", "2,5", "2,6", "2,7", 
   "2,8"}}, {"", {"3,1", "3,2", "3,3", "3,4", "3,5", "3,6", "3,7", 
   "3,8"}}, {"", {"4,1", "4,2", "4,3", "4,4", "4,5", "4,6", "4,7", 
   "4,8"}}}   *)

??

Have fun!

$\endgroup$
1
$\begingroup$

Perhaps something as simple as

Join[{something}, #] & /@ Table[{i, j}, {i, 4}, {j, 8}]
{{something, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8}}, 
 {something, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {2, 8}}, 
 {something, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}, {3, 7}, {3, 8}}, 
 {something, {4, 1}, {4, 2}, {4, 3}, {4, 4}, {4, 5}, {4, 6}, {4, 7}, {4, 8}}}
$\endgroup$
1
$\begingroup$
TableForm[Table[{i, j}, {i, 4}, {j, 8}], TableDirections -> {Column, Column, Row}]

Mathematica graphics

or

Flatten[Table[{i, j}, {i, 4}, {j, 8}], 1] // TableForm

Mathematica graphics

Exporting:

Export["filename.csv", Flatten[Table[{i, j}, {i, 4}, {j, 8}], 1]]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.