Skip to content

Commit

Permalink
getColumnAsMatrix for Table #508
Browse files Browse the repository at this point in the history
  • Loading branch information
clem-xry committed Jul 24, 2024
1 parent 0501441 commit a12eec5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lphy/src/main/java/lphy/core/model/datatype/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ public String[] getColumnNames() {
return keySet().toArray(new String[0]);
}

@MethodInfo(description = "return the 2d matrix of phi and psi angles.")
public Double[][] getColumnAsMatrix(Integer... ArrayIndex) {
Double[][] anglesMatrix = new Double[ArrayIndex.length][];
for (int i = 0; i < anglesMatrix.length; i++) {
List column = getColumn(ArrayIndex[i]); //get column 1 and column 2
anglesMatrix[i] = new Double[column.size()];
for (int j = 0; j < column.size(); j++) {
anglesMatrix[i][j] = Double.parseDouble(column.get(j).toString());
}
}
return anglesMatrix;
}

//TODO set column type ?


Expand Down

0 comments on commit a12eec5

Please sign in to comment.