Hi, how to adding value to array in existing array ?

조회 수: 4 (최근 30일)
Oman Wisni
Oman Wisni 2018년 10월 23일
편집: Oman Wisni 2018년 11월 6일
I have aray containing headers and values from some feature extractions. I also have 275 images. When I run my code, I want the value from the overall extraction of my image to be stored in the same array without deleting the extraction value of the previous image feature. below I created a code that only stores feature extraction values from one image, when I run the code for the next image, the previous value disappears. Please help me to complete my code. Thanks
header = {'area','perimeter','roundness','solidity','slimness','rectangu','NF','RPD'};
classinfo = {Area Perimeter Round Slimness Rect soli NF RPD RPLW};
Fitur = [header; classinfo];
  댓글 수: 12
Kevin Chng
Kevin Chng 2018년 10월 23일
편집: Kevin Chng 2018년 10월 23일
Does it working for you? if yes, kindly accept my answer.
Oman Wisni
Oman Wisni 2018년 10월 23일
of course sir, I received all your answers.

댓글을 달려면 로그인하십시오.

채택된 답변

Kevin Chng
Kevin Chng 2018년 10월 23일
편집: Kevin Chng 2018년 10월 23일
Solution is to save the array in .mat file, therefore, for next time to run the script, it will load the mat file, and add new value to the variable/table in the .mat file.
%save in array matlab
try
load Fitur.mat
catch me
end
if exist('Fitur','var')~=0
height = size(Fitur,1);
ID = height+1;
else
Fitur = [];
ID = 1;
end
classinfo = [ID area perimeter roundness solidity slimness rectangu NF RPD...
RPLW M1 M2 M3 M4 M5 M6 M7 mu deviasi energi entropi smoothness...
contrast homogenitas energi korelation];
Fitur = [Fitur; classinfo];
Fiturtable=array2table(Fitur);
header = {'ID' 'area','perimeter','roundness','solidity','slimness','rectangu','NF','RPD'...
'RPLW','M1','M2','M3','M4','M5','M6','M7','mu','deviasi','energi','entropi','smoothness'...
'contrast','homogenitas','energi2','korelation'};
Fiturtable.Properties.VariableNames = header;
save('Fitur.mat','Fitur','Fiturtable')
  댓글 수: 53
Kevin Chng
Kevin Chng 2018년 11월 1일
All the best
Oman Wisni
Oman Wisni 2018년 11월 6일
편집: Oman Wisni 2018년 11월 6일
Sir, I want to take all the pictures from my folder. I have made a code to take all the pictures and from each of the images I extracted the feature. after getting the value from feature extraction I want to save it in a table that was created. but I got an Error using cellstr.
Here I attached the file sir, please help me to fix my code sir. Thank you sir

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by