Skip to content

Commit 5216a6a

Browse files
committed
Fix: Python to MATLAB string array conversion
Conversion from a py.list into a `string` array fails in MATLAB versions older than 2022a.
1 parent 3f5ebc5 commit 5216a6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mhkit/utils/convert_numeric_dataframe_to_struct.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
%
1818
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1919

20-
columns = string(py.list(df.columns.values));
20+
columns = cell(df.columns.values.tolist());
2121
result_struct = struct();
2222

2323
for i = 1:length(columns)
24-
this_column = columns{i};
24+
this_column = char(columns{i});
2525
result_struct.(this_column) = double(df.get(this_column).values.tolist());
2626
end
2727
end

0 commit comments

Comments
 (0)