Save to json problem

3 ビュー (過去 30 日間)
DIMITRIOS THEODOROPOULOS
DIMITRIOS THEODOROPOULOS 2019 年 1 月 29 日
コメント済み: KSSV 2019 年 1 月 29 日
I create these columns from a for loop. idx are indexes eg idx=[2 3 45].
Area ,Eccentricity etc are regionprops.
Each Pollen has an Area ,an Eccentricity,an Euler etc
I try to save to json by creating a structure.I use saveJSONfile from Matlab Exchange
i have this problem
for j=1:length(idx)
Pollen(j,:)=j;
Area(j,:)=area(idx(j)).Area;
Eccentricity(j,:)=eccentricity(idx(j)).Eccentricity ;
Euler(j,:)=euler(idx(j)).EulerNumber;
Perimeter(j,:)=perimeter(idx(j)).Perimeter;
Orientation(j,:)=orientation(idx(j)).Orientation;
end
data.Pollen=Pollen'
data.Area=Area'
data.Eccentricity=Eccentricity'
data.Euler=Euler'
data.Perimeter=Perimeter'
data.Orientation=Orientation'
fullFileNameJason=fullfile(folder,'SingleValues.json');
saveJSONfile(data, fullFileNameJason);

回答 (1 件)

KSSV
KSSV 2019 年 1 月 29 日
Check the way you are creating the structure....Read about structure
S = struct ;
for i=1:3
S(i).Pollen = rand(1,3) ;
S(i).Area = rand(1,3) ;
end
  6 件のコメント
DIMITRIOS THEODOROPOULOS
DIMITRIOS THEODOROPOULOS 2019 年 1 月 29 日
Index exceeds matrix dimensions.......
says.....
KSSV
KSSV 2019 年 1 月 29 日
You need to fix the loop j...may be it takes values from 1:3.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeJSON Format についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by