How to concatenate two matrices horizontally

Hey there! New to golang here. I’m struggling with concatenating two matrices, e.g.:






Google has practically no solution. I came so far (also tried with append but the problem is [][]float64):

Any help appreciated, thank you!

I think you’re probably off to the right start with append. Can you share what you tried with append?

Thanks for the reply. I think the append version is way off:

They’re both really close; the only thing you have to change in the one with append is to set mat4 to a [][]float64, not a []float64, and then add the index, i, to your mat4 slice of slices when you loop through mat1: The Go Playground

1 Like

:slight_smile: Thank you, ohhh secrets are in details :+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.