Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix matlab tests #3886

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Bindings/Java/Matlab/tests/testConnectorsInputsOutputs.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
source = TableSource();
source.setName('source');
table = TimeSeriesTable();
labels = StdVectorString(4);
labels.set(0, 'c1'); labels.set(1, 'c2'); labels.set(2, 'c3'); labels.set(3, 'c4');
labels = StdVectorString();
labels.add('c1'); labels.add('c2'); labels.add('c3'); labels.add('c4');
table.setColumnLabels(labels);
row = RowVector(4, 1.0);
table.appendRow(0.0, row);
Expand Down
25 changes: 13 additions & 12 deletions Bindings/Java/Matlab/tests/testOsimC3D.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
% col numbers.

% Test Marker Rotations
randomRows = randsample(markers.getNumRows(),10)-1;
randomCols = randsample(markers.getNumColumns(),10)-1;
randomRows = randi(markers.getNumRows(),10)-1;
randomCols = randi(markers.getNumColumns(),10)-1;
for i = 1 : 10
% Get the values in the original and rotated marker tables
loc = osimVec3ToArray(markers.getRowAtIndex(randomRows(i)).get(randomCols(i)));
Expand All @@ -68,8 +68,8 @@
end

% Test Force Rotations
randomRows = randsample(forces.getNumRows(),6)-1;
randomCols = randsample(forces.getNumColumns(),6)-1;
randomRows = randi(forces.getNumRows(),6)-1;
randomCols = randi(forces.getNumColumns(),6)-1;
for i = 1 : 6
% Get the values in the original and rotated marker tables
val = osimVec3ToArray(forces.getRowAtIndex(randomRows(i)).get(randomCols(i)));
Expand All @@ -93,7 +93,7 @@

% Forces should remain unchanged, point and moments should be in meters
% (divided by 1000)
randomRows = randsample(forces.getNumRows(),101)-1;
randomRows = randi(forces.getNumRows(),101)-1;
for i = 0 : forces_m.getNumColumns() - 1

col = forces_rotated.getDependentColumnAtIndex(i);
Expand All @@ -106,17 +106,18 @@
d = col.get(randomRows(u));
d_m = col_m.get(randomRows(u));

assert(d.get(0)==d_m.get(0),'Force Data has been incorrectly altered');
assert(d.get(1)==d_m.get(1),'Force Data has been incorrectly altered')
assert(d.get(2)==d_m.get(2),'Force Data has been incorrectly altered')
assert(abs(d.get(0)-d_m.get(0))<.001,'Force Data has been incorrectly altered');
assert(abs(d.get(1)-d_m.get(1))<.001,'Force Data has been incorrectly altered');
assert(abs(d.get(2)-d_m.get(2))<.001,'Force Data has been incorrectly altered');

else
% Get the values
d = col.get(randomRows(u));
d_m = col_m.get(randomRows(u));

assert(d.get(0)/1000==d_m.get(0),'Point or Moment Data has been incorrectly altered');
assert(d.get(1)/1000==d_m.get(1),'Point or Moment Data has been incorrectly altered');
assert(d.get(2)/1000==d_m.get(2),'Point or Moment Data has been incorrectly altered');
assert(abs(d.get(0)/1000-d_m.get(0))<.001,'Point or Moment Data has been incorrectly altered');
assert(abs(d.get(1)/1000-d_m.get(1))<.001,'Point or Moment Data has been incorrectly altered');
assert(abs(d.get(2)/1000-d_m.get(2))<.001,'Point or Moment Data has been incorrectly altered');

end
end
end
Expand Down
Loading