New answers tagged

0

I figured it out. data = Import[ "/Users/myname/Documents/foldername/filename.txt", "Table"] Total[data, {1}] Part of the error was that I had an empty row at the end of my text file.


1

You need Import, Part (i.e. [[...]]), probably Span (i.e. ;;), and Total. Import the data: data = Import["path\to\yourdatafile.txt", "Table"]; Sum all entries in the first column: Total@data[[All, 1]] Sum entries in the third column and in the second to third row: Total@data[[2 ;; 3, 3]] Sum entries in column 2, rows 1 and 3: Total@data[[{1, 3}, ...



Top 50 recent answers are included