Skip to content

Fix issue #58 #59

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion readZattrs.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function zattrsStruct = readZattrs(filepath)
%READZATTRS Helper function to read the JSON file .zattrs which contains
%user defined attributes for a Zarr array or group.
%user-defined attributes for a Zarr array or group.

% Copyright 2025 The MathWorks, Inc.

Expand Down
16 changes: 7 additions & 9 deletions zarrinfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
filepath {mustBeTextScalar, mustBeNonzeroLengthText, mustBeFolder}
end

% .zarray and .zgroup are valid metadata files for Zarr v2 which contain library
% defined attributes.
% zarr.json is valid metadata file for Zarr v3 containing library defined
% attributes.
% .zarray and .zgroup are valid metadata files for Zarr v2 which contain
% library-defined attributes. zarr.json is valid metadata file for Zarr v3.
% containing library-defined attributes.
% If the location is a Zarr array
if isfile(fullfile(filepath, '.zarray'))
infoStr = fileread(fullfile(filepath, '.zarray'));
Expand All @@ -38,12 +37,11 @@
% User defined attributes are contained in .zattrs file in each array or group store
if isfile(fullfile(filepath, '.zattrs'))
userDefinedInfoStruct = readZattrs(filepath);
userDefinedfieldnames = fieldnames(userDefinedInfoStruct);
if (numel(userDefinedfieldnames) > 0)
for i = 1:numel(userDefinedfieldnames)
infoStruct.(userDefinedfieldnames{i}) = userDefinedInfoStruct.(userDefinedfieldnames{i});
end
userDefinedFieldNames = fieldnames(userDefinedInfoStruct);
for i = 1:numel(userDefinedFieldNames)
infoStruct.(userDefinedFieldNames{i}) = userDefinedInfoStruct.(userDefinedFieldNames{i});
end

end

end