Skip to content

Instantly share code, notes, and snippets.

@chamathabeysinghe
Last active February 17, 2018 17:05
Show Gist options
  • Save chamathabeysinghe/1f2228b752a2129e257c635884dbabbd to your computer and use it in GitHub Desktop.
Save chamathabeysinghe/1f2228b752a2129e257c635884dbabbd to your computer and use it in GitHub Desktop.
fileM = $M #read the file given by M
numRowsToPrint = ifdef($rowsToPrint, 2) # default to 2
numColsToPrint = ifdef($colsToPrint, 2) # default to 2
m = read(fileM)
for (i in 1:numRowsToPrint) {
for (j in 1:numColsToPrint) {
print('[' + i + ',' + j + ']:' + as.scalar(m[i,j]))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment