You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Hi, how to adding value to array in existing array ?
1 view (last 30 days)
Show older comments
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 Comments
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
typically to design your loop should be
for i=1:1:275
%how you read your image data
header = {'area','perimeter','roundne
if true
% code
endss','solidity','slimness','rectangu','NF',
'RPD'};
classinfo = {Area Perimeter Round Slimness Rect soli NF RPD RPLW};
Fitur{i} = [header; classinfo];
end
Therefore, you should arrange your image in indexing as well.for example
S = dir('*,jpeg')
imagedata = imread(S(i).name);
If you are unclear with my suggestion, you may post your complete code here, I try to edit for you
Oman Wisni
on 23 Oct 2018
Edited: Oman Wisni
on 23 Oct 2018
Thanks sir. Sir I already trying you code
for i = 1:total_image
total_image = numel(fname);
header = {'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'};
if true
classinfo = {Area Perimeter Round Slimness Rect soli NF RPD RPLW...
M1 M2 M3 M4 M5 M6 M7...
mu deviasi energi entropi smoothness...
contr homom energ corr};
Fitur{i} = [header; classinfo];
end
end
But I get result like below, the result still removing the previous values sir
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193384/image.png)
I want in one array to store all the values of all images like in Excel,
example: first row is filled by the extraction value of feature image 1
second row is filled by the extraction value of feature image 2, and so on until the total image is available..
this I mean
Id is the ID for every image and F1 - F11 is the feature extraction.
Thanks sir
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193385/image.png)
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
Fitur=[]
for i = 1:total_image
%total_image = numel(fname);
if i<10
ID = sprintf('T000%d',i)
else
ID = sprintf('T00%2d',i)
end
classinfo = [ID Area Perimeter Round Slimness Rect soli NF RPD RPLW...
M1 M2 M3 M4 M5 M6 M7...
mu deviasi energi entropi smoothness...
contr homom energ corr];
Fitur = [Fitur ; classinfo];
end
Fiturtable=array2table(fitur);
header = {'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'};
Fiturtable.Properties.VariableNames = header;
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
Then I recommend put them in table instead of cell
Oman Wisni
on 23 Oct 2018
Edited: Oman Wisni
on 23 Oct 2018
Sir,
Undefined function or variable 'str_e'.
and
Undefined function or variable 'Fitur'.
Error in cobahitung_manual (line 139) Fitur = [Fitur ; classinfo];
error everywhere sir, the results are not what I want
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193387/image.png)
Kevin Chng
on 23 Oct 2018
Modified. Sorry my typo error. Refer to the code again. Or if you want me try out, you may attach your script and relevant input file(.mat,.csv,..) here.
Oman Wisni
on 23 Oct 2018
for the histogram value, I made it in another script, in that script I just called the function sir. maybe the histogram can be ignored or commented. sorry too troublesome
Kevin Chng
on 23 Oct 2018
I try to run it, however, i don't have function feature_vec .
I have tried to edit code for it. I noticed you use uiget to load the image manually, i guess next step you have tried to look solution to load all your image automatically.
Try my code in attached and see.
Oman Wisni
on 23 Oct 2018
yes Sir, because function feature_vec in another script. I only call the function in there. sorry before I not tell it. Yes sir I will follow your code. thank you
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
Does it working for you? if yes, kindly accept my answer.
Accepted Answer
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
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 Comments
Oman Wisni
on 23 Oct 2018
Yes, Yes sir :) Sir, you did it. thank you very much sir :)
Sir. sorry, one question again about this. sir, if I have extracted the features of all images, extracting the 275 images feature has been automatically saved? that is, if I leave the worksheet later, can it still be accessed for use in the training and testing process?
Kevin Chng
on 23 Oct 2018
extracting the 275 images feature has been automatically saved?
Not clear what do you mean. I guess you don't to one by one to load your image by uiget(). Instead of that, you are looking to load your image into script and process it automatically in a loop.
if I leave the worksheet later, can it still be accessed for use in the training and testing process?
What is the worksheet you mean? The mat.file?
Oman Wisni
on 23 Oct 2018
No sir, your guess were right.
I mean if later I want to do training and testing by taking the extraction value of the feature that has been saved in mat.file, can I call it according to the ID I have?
Kevin Chng
on 23 Oct 2018
Edited: Kevin Chng
on 23 Oct 2018
Hi Oman,
for first question:
Use dir() to get all name of your image. Then later use forloop to open them iteratively.
for second question
Ya. Your ID is in first column and in sequence, so it is pretty much easier compared to ID is not in sequence.
Let say you want ID=5, simple as
ID5table = Fiturtable(5,:)
More information how to use table, you can read MATLAB documentation.
Good luck.
Oman Wisni
on 23 Oct 2018
yes sir, thanks for many answer. It is clear now.
Sir, I made a mistake, when I run the program I choose the same image twice, so the value stored in mat is the same two values. I want to delete one of them, how can I delete it?
Kevin Chng
on 23 Oct 2018
In your command window of matlab, if let say you want delete 2nd row.
Fiturtable(2,:) = []
Oman Wisni
on 24 Oct 2018
Sir, I have image with name image.
Example :
Jasminum1
Jasminum2 . . .
Jasminum25
Glycosmic1
Glycosmic2 ...
Glycosmic25
I want the ID of this image using the name of image, is it possible to do that in your code above? If I only use ID 1, 2, 3 ...etc I get difficult for call and identified it when I will train data and put target. Thanks sir
Kevin Chng
on 24 Oct 2018
Some changes have to be done.
%save in array matlab
try
load Fitur.mat
catch me
end
if exist('Fitur','var')~=0
height = size(Fitur,1);
else
Fitur = [];
IDName=[]
end
classinfo = [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 = {'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;
ID = %yourfilename
IDName = [IDName;ID];
Fiturtable2 = [table(IDName) Fiturtable];
Fiturtable2.Properties.VariableNames(1) = {'IDName'} ;
save('Fitur.mat','Fitur','Fiturtable2')
However, the code is not optimised. But i believe it is working for you.
Oman Wisni
on 24 Oct 2018
Yes sir, I will try. Sorry beforehand sir, maybe I will ask a lot later, will it not bother you later? this is for my last project, I have difficulty when I will do training and testing for image data, I use Multi Layer Perceptron with the data used is taken randomly with k-fold validation. I don't know many about image processing, so please help me if there are some things I want to ask. Thanks sir for fast respons.
Kevin Chng
on 24 Oct 2018
No worries. you may post it in new question to get faster response from community.
Oman Wisni
on 24 Oct 2018
Sir, I have tried the code that you gave me, and there are some codes that I complete according to my needs without changing your code. but I got an error like this below :
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in cobahitung_manual (line 142)
Fitur = [Fitur; classinfo];
Oman Wisni
on 24 Oct 2018
Edited: Oman Wisni
on 24 Oct 2018
Sir, I already tried again, the error now like this
Error using cobahitung_manual (line 147)
The VariableNames property must contain one name for each variable in the table.
And the result like below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193440/image.png)
Kevin Chng
on 24 Oct 2018
No worries.
Error in cobahitung_manual (line 142)
Fitur = [Fitur; classinfo];
Delete the mat file in your folder. You have to redo again according to the new code due to different in dimension.
Oman Wisni
on 24 Oct 2018
Sir, I deleted it and even changed the name "Fitur" to 'Input',so that is no longer the cause. But the result is still the same as the one above.
Error using cobahitung_manual (line 147)
The VariableNames property must contain one name for each variable in the table
Then I modified some code and I get new error like below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193468/image.png)
this my code
try
load Input.mat
catch me
end
if exist('Input','var')~=0
height = size(Input,1);
else
Input = [];
IDName=[];
end
classinfo = [IDName Area Perimeter Round Slimness Rect soli NF RPD RPLW...
M1 M2 M3 M4 M5 M6 M7...
mu deviasi energi entropi smoothness...
contr homom energ corr];
Input = [Input; classinfo];
Inputtable=array2table(Input);
header = {'IDName','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'};
%Inputtable.Properties.VariableNames = header;
ID = foldername;
IDName = [IDName;ID];
Inputtable2 = [table(IDName) Inputtable];
Inputtable2.Properties.VariableNames(1) = header;
save('Input.mat','Input','Inputtable2');
Kevin Chng
on 25 Oct 2018
Edited: Kevin Chng
on 25 Oct 2018
Try,
try
load Input.mat
catch me
end
if exist('Input','var')~=0
height = size(Input,1);
else
Input = [];
IDName=[];
end
classinfo = [IDName Area Perimeter Round Slimness Rect soli NF RPD RPLW...
M1 M2 M3 M4 M5 M6 M7...
mu deviasi energi entropi smoothness...
contr homom energ corr];
Input = [Input; classinfo];
Inputtable=array2table(Input);
header = {'IDName','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'};
ID = "foldername"; %String
IDName = [IDName;ID];
Inputtable2 = [table(IDName) Inputtable];
Inputtable2.Properties.VariableNames = header;
save('Input.mat','Input','Inputtable2','IDName');
Oman Wisni
on 25 Oct 2018
Edited: Oman Wisni
on 25 Oct 2018
The result still same sir.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193470/image.png)
ID = "foldername"; %String
I though get error in there sir, but I dont know how to fix it. I use foldername for call the image with the name of image then the name of image automatically become ID.
When I modified and convert table using CELL2TABLE I get error like this :
Error using cell
Conversion to cell from char is not possible.
Oman Wisni
on 25 Oct 2018
this sir, I attached my .m file. Some feature extractions whose functions are in different scripts I delete so you can run this code and see where the error is. I have seen a number of examples whose problems are similar to me, but I still can't fix them. I give you a lot of problems, sorry and please be patient sir
Kevin Chng
on 25 Oct 2018
Edited: Kevin Chng
on 25 Oct 2018
Do you mind insert your input data? some file for me to try out. No worries.
Oman Wisni
on 25 Oct 2018
Edited: Oman Wisni
on 25 Oct 2018
do you mean the image I use? this sir.
I have 275 images from 11 species, each species consists of 25 images. I save my data with the following name:
base1 ... base25,
pucuk1 ... pucuk25, etc
I want to make an ID with the name of each image I take. For example base1, so the ID is 'base1'.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193480/image.bmp)
Kevin Chng
on 25 Oct 2018
Edited: Kevin Chng
on 25 Oct 2018
Done. Sorry for my late as I have something to do.
Refer to attached. the ID name will follow the name of your inserted image.
Keep it up. Your work is great.
Oman Wisni
on 25 Oct 2018
No sorry sir, that is enough to help me. Thank you very much sir :)
I will continue this until it's finished. Now I will try it.
Oman Wisni
on 26 Oct 2018
Hi Sir, I will do training and image testing using a multilayer perceptron. But I am still confused what should I do first? I've got all feature extractions from the image that I have as many as 275.
If not mind can you give me some clue or how I can do it ? thanks sir.
I before already ask here, but there are no get answer. May my question not clear:(
Kevin Chng
on 26 Oct 2018
I guess next step should be machine learning.
You may take a look at regression learner/classification?
Oman Wisni
on 26 Oct 2018
Yes sir, you were right.
I already look. I understand theory of multilayer perceptron and k-fold cross validation, but in matlab I don't know how implement it. I already reading some code and try to understand but I still confused.
After got all feature extraction. I think, I have to determined the target to adjust to the class to be clasified
Oman Wisni
on 27 Oct 2018
Edited: Oman Wisni
on 27 Oct 2018
Sir, I want to ask.
The table that you make above 'input.mat' can I add a sheet like in excel? Like 'sheet1,sheet2...etc' in that table?
The table above the contents is extracting features from the image that I input, then if I want to add the value of the target that I will use for classification can I put it in the table input.mat? or do I have to create a new table for the target?
Thanks sir,
Kevin Chng
on 27 Oct 2018
Hi,
After got all feature extraction. I think, I have to determined the target to adjust to the class to be clasified
Yes, it is essential if you are looking machine learning - Classification.
'input.mat' can I add a sheet like in excel? Like 'sheet1,sheet2...etc'
Yes, typically there are 3 ways writting to excel which are readtable(),xlsread(), and ActiveX.
However, i recommend you post this question in new question, then you will get more answer from community on how to export to excel. It is really interesting if you get to know how to do it in different ways.
then if I want to add the value of the target that I will use for classification can I put it in the table input.mat? or do I have to create a new table for the target?
I guess you are looking to add your classification value into your table, there is no necessary to create a new table for it. You may add it to your last column
table(??,end+1) = classfication
Oman Wisni
on 27 Oct 2018
Edited: Oman Wisni
on 27 Oct 2018
Yes sir. I understand your answer, thanks sir
Oman Wisni
on 28 Oct 2018
Edited: Oman Wisni
on 28 Oct 2018
hi sir, sorry beforehand i asked here again.
sir, I want to create an array to store the target value of each image that I input. I have 11 types of leaves, every 1 type of leaf has 25 images
The example like below sir :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193559/image.png)
try
load Target.mat
catch me
end
if exist('Target','var')~=0
height = size(Input,1);
else
%Input = [];
IDName=[];
end
ID = cellstr(foldername); %String
IDName = [IDName;ID];
target = zeros(1,275);
target(:,1:25) = 1;
target(:,26:50) = 2;
target(:,51:75) = 3;
target(:,76:100) = 4;
target(:,101:125) = 5;
target(:,121:150) = 6;
target(:,151:175) = 7;
target(:,176:200) = 8;
target(:,201:225) = 9;
target(:,226:250) = 10;
target(:,251:275) = 11;
Targettable.Properties.VariableNames = target;
save('Target.mat','target','Targettable','IDName');
in above is my code, I already run it but the result not I want. please fix it
Image Analyst
on 28 Oct 2018
I don't know exactly what the last paragraph is saying. But in the beginning you say "Im trying make code this is look not good." so I'll give you some pointers on that:
- Use comments to document your code. Comments begin with a %.
- Indent your code properly by typing control-a (to select all code), then type control-i (to fix the indenting).
- Use exist('target.mat', 'file') to check that target.mat exists before you load it.
- In the catch statement, you should really warn the user and exit. There is no sense in trying to continue if the load() did not work.
- MATLAB is case sensitive so beware target and Target refer to two different variables.
- Read this link on MATLAB Coding Standards and style standards.
Oman Wisni
on 28 Oct 2018
Edited: Oman Wisni
on 28 Oct 2018
@Mr.Analyst, I want to create array to store my value from target. I have 11 types of leaves, every 1 type of leaf has 25 images.
I already have table Input.mat. I want add the target. Is what I want possible to do? if not what the solution, I only want later make me little easy for doing clasification.
I want my array of target look like picture below, Where IDName is the the name of the image that I input.
Please guide me sir. Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193560/image.png)
Kevin Chng
on 29 Oct 2018
Hi Omar,
Image Analyst's comment is really worth to have a read. Try to understand.
In your code,
1) Target and target are different variables. MATLAB is case-sensitive. try to standardise them first.
2) target(:,1:25) = 1; target(row,column), i guess you should assign your classification to row instead of column which is
target(1:25,:) = 1;
3) There is Targettable. But you are assigning you value to become the header of the table instead of content.
Targettable.Properties.VariableNames = target;
Take a read how to assign array to table, it will help you.
Oman Wisni
on 29 Oct 2018
Edited: Oman Wisni
on 29 Oct 2018
Mr.Kevin thanks for you clear explain. Yes I want assign it to row but when I run the result is coloum and IDName get from the image name I input it makes me asking
Oman Wisni
on 29 Oct 2018
Edited: Oman Wisni
on 29 Oct 2018
Sir, I already tryinng to fix my code, here my code :
try
load target.mat
catch me
end
if exist('target','var')~=0
height = size(target,1);
else
target = [];
IDName=[];
end
target = zeros(1,175);
target(:,1:25) = 1;
target(:,26:50) = 2;
%target(51:75,:) = 3;
%target(76:100,:) = 4;
%target(101:125,:) = 5;
%target(121:150,:) = 6;
%target(151:175,:) = 7;
%target(176:200,:) = 8;
%target(201:225,:) = 9;
%target(226:250,:) = 10;
%target(251:275,:) = 11;
target = target();
targettable = array2table(target);
ID = cellstr(foldername); %String
IDName = [IDName;ID];
targetttable2 = [table(IDName) targettable];
%targettable.Properties.VariableNames = target;
save('target.mat','target','targettable','IDName');
I get result what I want, but that assign to coloum, like below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193569/image.png)
when I run it for the second time with different types of image it was error. And I already trying with code which already you give, but the result same too. Thanks
target(1:25,:) = 1;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193571/image.png)
Kevin Chng
on 30 Oct 2018
target = zeros(1,175);
target(:,1:25) = 1;
target(:,26:50) = 2;
You only initiate one row and 175 columns, I did't study all your code, but you don't need to initiate the variables in MATLAB, you may change to
target(1:25,1) = 1;
target(26:50,1) = 2;
Oman Wisni
on 30 Oct 2018
Sir I already trying, the result already become row. But I get error
All tables in the bracketed expression must have the same number of rows in this code
targetttable2 = [table(IDName) targettable];
it seems like I was wrong to declare on the IDName section
Oman Wisni
on 30 Oct 2018
Sorry sir, can you help me to fix it, I already trying some way cant solved it. I really need it to fix for continue again.
Thanks
Kevin Chng
on 30 Oct 2018
targetttable2 = [table(IDName) targettable];
Your problem is now you only got one row of 1Dname, but targettable has 275 rows.
Therefore, their dimension is different.
I'm not really sure what are you trying to do. But I advise to add your classification to your original table instead.
As your code become more complicated, you have to equip yourself with some MATLAB knowledge. How to merge table/array with same dimension?
Columns & Row? *
Indexing in MATLAB*
for your code, coding is very dynamic, I try to edit your code for your need
try
load Input.mat
catch me
end
if exist('Input','var')~=0
height = size(Input,1);
else
Input = [];
IDName=[];
end
classinfo = {area perimeter roundness solidity slimness rectangu NF RPD...
RPLW contrast homogenitas energi korelation};
Input = [Input; classinfo];
Inputtable=array2table(Input);
header = {'IDName','area','perimeter','roundness','solidity','slimness','rectangu','NF','RPD'...
'RPLW','contrast','homogenitas','energi2','korelation'};ID = cellstr(fnameN); %String
IDName = [IDName;ID];
IDdimension = size(ID,1);
Classification = ceil(IDdimension/5);
Inputtable2 = [table(IDName) Inputtable];
Inputtable2.Properties.VariableNames = header;
save('Input.mat','Input','Inputtable2','IDName');
or refer to attached.
Classification = ceil(IDdimension/5);
the line above is playing the trick that first 5 image classified as 1, subsequently classified as 2, and.....
Oman Wisni
on 30 Oct 2018
Edited: Oman Wisni
on 30 Oct 2018
Thank you very much sir, I will trying now.
Yes sir I create target for later I do clasification using multilayer, so In data train I can call input from input.mat and target from target.mat
So it makes me make new table for target.
Can't open your file, cause the type your file can't open in matlab, And result no change
Oman Wisni
on 1 Nov 2018
Hi, Mr.Kevin. Thanks for your answer. I did not ask again cause I not brave for do it. I'm really appreciated your answer, Thank you. Your first answer is very helpful and according to my wishes, but for this one it's not like that.
I'm sorry sir.
1. In this code you say the line above is playing the trick that first 5 image classified as 1, subsequently classified as 2, and.....
But when I run more than 5 image, it still classified as 1. And in the input.mat table there is no additional column for classified.
Classification = ceil(IDdimension/5);
2. I want to classify images of 1st species consisting of 25 images into target 1st, and so on until the 11th species for target 11th. To find out the species is entered into target 1st or 2nd ... 11th it is specified by IDName which get from the name of the image entered.
Maybe in declaring using the IF statement. I can only make the logic but to make the matlab understand what I want I can't, sir. For example like this:
if IDName = Piper
Target = 1;
ifelse IDName = Jasminum
Target = 2
... until if IDName = Guajava
Target = 11;
And save all this result in the Target table which is filled with IDName and target. So that later the results in the target table are like this, here with the illustrations :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194403/image.png)
Thank you sir
Kevin Chng
on 1 Nov 2018
Hi, I put wrong variable into counting the size
IDdimension = size(IDName,1);
Refer to attached, I have verified it, and it is working well. In your input table, the second column is classification.
Kevin Chng
on 1 Nov 2018
Edited: Kevin Chng
on 1 Nov 2018
Hi
IDName = Piper
This is not string comparison syntax. Study this
However, command above is comparing the whole word. But you have labelled your file as Piper1,Piper2,Piper3........
You may play some trick like
IDNameC = char(IDName)
if strcmp(IDNameC(1:5), 'Piper')==1
Target = 1;
ifelse ......
Oman Wisni
on 1 Nov 2018
Yes sir I received your file attached. Thank you :) But can you continue the 2nd code? Can you give me full code and save to another table. I will use both, which one I feel easy to implement I will do it,
Kevin Chng
on 1 Nov 2018
But can you continue the 2nd code?
What is 2nd code?
Yes sir, before I already look for that link, but I can't declarad :(
Any error from there?
Here, we prefer to discuss error and how to debug them so everyone can learn how to code it in correct and better way. So called learning process.
Oman Wisni
on 6 Nov 2018
Edited: Oman Wisni
on 6 Nov 2018
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194503/image.png)
Here I attached the file sir, please help me to fix my code sir. Thank you sir
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)