Questions tagged [concatenation]

Questions on how to concatenate/join/merge lists/arrays of symbols/numbers/strings/etc. to obtain a given form of the output.

Filter by
Sorted by
Tagged with
10 votes
8 answers
453 views

Element by element concatenation of two string lists

I have two lists of strings: month = {january, february, march} year = {2013, 2013, 2013} I want to concatenante these element by element with the final result of ...
Todd Dixon's user avatar
5 votes
3 answers
165 views

How to create all $1$'s vectors of length $n$ without using Tuples[]? [closed]

I am having problems with creating a vector of 1s of length (for example) n=4. I tried ones=Tuples[{1},4] This outputs {{$1,1,1,1$}} The problem I have here, is ...
QC123_367's user avatar
  • 491
1 vote
1 answer
87 views

How to concatenate an array of matrices?

When trying to concatenate matrices i usually use Join. But having the matrices in an array it gets tricky. As an example: ...
zurg's user avatar
  • 117
1 vote
1 answer
83 views

Concatenating matrices using headings

New to Mathematica. I want to create and combine K1, K2, and K3 (shown in the first picture below) into the 8x8 matrix shown in the second picture below and keep the heading as shown if possible: ...
user avatar
1 vote
1 answer
256 views

How to use 'Join' and '& /@' : combining all .csv files in a directory into a single .csv file automatically

I would like to import all .csv files in a directory and combine them into a single file using Join. I can do this manually but when I try to automate it using <...
Drotar's user avatar
  • 107
11 votes
5 answers
756 views

Convert a list to an integer

How can we convert a list to an integer correctly? {5, 22, 4, 5} -> 52245? When I use the command FromDigits in Mathematica ...
ABCDEMMM's user avatar
  • 1,816
4 votes
3 answers
601 views

How to join many tables side by side?

I have function for table $t$ t[n_] := Table[i*n, {i, 1, 3}]; For example t[1]=(1, 2, 3), t[2]=(2, 4, 6), and t[3]=(3, 6, 9) To join $n=3$ tables side by side ...
Nigel1's user avatar
  • 741
2 votes
5 answers
104 views

Build a new flat list from a mix of part items and part spans

I want to modify a list of table row by adding an extra column. For that I Map the data with a pure function that evluate the new column value from exisiting one ...
Sylvain Leroux's user avatar
3 votes
1 answer
88 views

What's the easiest way to combine specific columns of two matrices?

given matrices A = {{3, 10, 10, 5.`}, {4, 10, 10, 6.`}, {5, 10, 10, 7.`}} B = {{6, 10, 10, 5.`}, {7, 10, 10, 6.`}, {8, 10, 10, 7.`}} how can i get a matrix which ...
user34047's user avatar
  • 335
0 votes
1 answer
84 views

How to use Strings and Functions With Conditions

Very new to Mathematica so this might be really simple. I have the function pow[x_,r_]:= x^r where r is rational due to ...
user58133's user avatar
1 vote
0 answers
54 views

How to define a symbollic matrix with variables and numbers

Newbie here. I want to define a (user-defined)function to return symmetric matrices, as I need to define quite a few tensors. I am able to do this using strings. But I need the matrix entries to be ...
roshan ram's user avatar
2 votes
1 answer
308 views

Concatenating a table of ordered pairs

...
Lopey Tall's user avatar
3 votes
2 answers
130 views

Obtaining all possible ways to concatenate matrices

With Prepend we can add a line to all matrices in a set, like this: ...
Filburt's user avatar
  • 578
1 vote
2 answers
74 views

Building other matrices from these ones

First of all, I want to know if it is possible to make a constraint in a set of matrices that I have to obtain a subset. For example, if I have a set of square matrices ...
Filburt's user avatar
  • 578
0 votes
2 answers
1k views

How to concatenate functions and strings

I have f[x_]=Log[1+x] g[x_]=TraditionalForm[Series[f[x], {x, 0, 4}]] Is there a way to get the answer to print out as ...
NumberCruncher's user avatar
5 votes
3 answers
443 views

List of the combinations of more lists via permutations

I would like to generate a list of all the possible combinations of two lists. As for instance, given L=3; list={0,1,2}; I would like to obtain the list {{0,...
Galuoises's user avatar
  • 523
3 votes
1 answer
112 views

Merge neighbour Lists in List

I think the following problem is a good exercise. In a List of Lists, merge lists which define neighbour intervals: for example, ...
anderstood's user avatar
  • 14.2k
7 votes
3 answers
3k views

how to concatenate a list of a list of strings

I have two lists of lists, La and Lb that I want to concatenate so that every element of a list n in La is concatenated with the ...
Andrew W's user avatar
  • 173
17 votes
3 answers
2k views

Simple way to concatenate Dataset columns

Consider these two datasets: d1 = Transpose@Dataset[<|"a" -> Range[5]|>]; d2 = Transpose@Dataset[<|"b" -> Range[5, 1, -1]|>]; {d1, d2} What's ...
Szabolcs's user avatar
  • 233k
2 votes
5 answers
1k views

How to switch from array to string?

Considering we have an array: a = {2/3, 4/5, 9/7, 3/7, 1/7, 1/9}; How can I get this to be: "2/3 4/5 9/7 3/7 1/7 1/9" ...
SuTron's user avatar
  • 1,698
7 votes
2 answers
10k views

Joining Together Strings and variables [closed]

I am trying to join together strings and variables as part of formatting the output of my code. For example how do I print the line "5 trees" where the number 5 is a variable n that could be changing. ...
lwcarani's user avatar
  • 179
10 votes
3 answers
2k views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
Nasser's user avatar
  • 137k
7 votes
4 answers
803 views

Concatenating strings, unevaluated expressions and evaluated expressions/values

Maybe this is something very simple to some of you. Anyway, I think this can be useful to many others like me. I would like to build an output that involves strings, unevaluated expressions and ...
Vicent's user avatar
  • 1,091
10 votes
2 answers
1k views

How to name a variable with the value of another variable?

A simple but very important (at least for me) question. In some languages for defining a variable, for example, we can do: i=10 "d"&i=30 So I have defined the variable d10, and... d10=30 ...
Luis Fernando Moura's user avatar
2 votes
1 answer
264 views

How to joint symbolic expressions together [duplicate]

I want to joint symbolic expressions together to create a another symbolic expressions. one way to do that is as follows: ...
Basheer Algohi's user avatar
6 votes
3 answers
364 views

How to 'merge' a list like FromDigits, but with a mixture of numbers and symbols?

How do I go from {C,4,G,5,S,7} to C4G5S7
Simon's user avatar
  • 493
6 votes
7 answers
4k views

Getting a String from a list of strings

Is there a way to write down Mathematica with a string such as: {"M","a","t","h","e","m","a","t","i","c","a"}?
Öskå's user avatar
  • 8,567