Skip to content

Commit 95bf510

Browse files
Add more robust conversion of nwbinspector values to string (#781)
Co-authored-by: Ben Dichter <[email protected]>
1 parent 3230248 commit 95bf510

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

inspectNwbFile.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@
111111
catch
112112
resultTable(i).location = "N/A";
113113
end
114-
resultTable(i).message = string(C{i}.message);
115-
resultTable(i).object_name = string(C{i}.object_name);
116-
resultTable(i).object_type = string(C{i}.object_type);
117-
resultTable(i).file_path = string(C{i}.file_path);
118-
resultTable(i).check_function_name = string(C{i}.check_function_name);
114+
resultTable(i).message = pyValueToString(C{i}.message);
115+
resultTable(i).object_name = pyValueToString(C{i}.object_name);
116+
resultTable(i).object_type = pyValueToString(C{i}.object_type);
117+
resultTable(i).file_path = pyValueToString(C{i}.file_path);
118+
resultTable(i).check_function_name = pyValueToString(C{i}.check_function_name);
119119
end
120120
resultTable = struct2table(resultTable);
121121
end
@@ -210,3 +210,11 @@
210210

211211
isNwbInspectorInstalled = status == 0;
212212
end
213+
214+
function strValue = pyValueToString(pyValue)
215+
if isa(pyValue, 'py.NoneType')
216+
strValue = string(missing);
217+
else
218+
strValue = string(pyValue);
219+
end
220+
end

0 commit comments

Comments
 (0)