How to merge two .mat files?

2 Ansichten (letzte 30 Tage)
Melaku Eneayehu
Melaku Eneayehu am 11 Mär. 2018
Kommentiert: Walter Roberson am 11 Mär. 2018
I am trying to do svm training https://in.mathworks.com/matlabcentral/fileexchange/55098-plant-leaf-disease-detection-and-classification-using-multiclass-svm-classifier and https://in.mathworks.com/matlabcentral/fileexchange/55107-brain-mri-tumor-detection-and-classification in the above two link when i load the training data-set i get two or more .mat file Example in the first link when i load Training_Data it open Train_feat and Train_label...how can i do this? but before this what am trying is... i have one folder who have 3 types of training image each type have 50 image, totally 150 training image(3 class) i add one row which count the no of row, class one will have record from row 1-50, second 51-100, third 101-150 while testing if k value falls from this it will display the class label of that training image, but the out put is not too good...so i want to try the above two link examples..thank you sorry and for this boring write.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Mär. 2018
Bearbeitet: Walter Roberson am 11 Mär. 2018
s1 = load('FirstFile.mat');
s2 = load('SecondFile.mat');
fn1 = fieldnames(s1);
fn2 = fieldnames(s2);
if any(ismember(fn1, fn2))
error('Those files have at least one variable with the same name, cannot merge them');
end
for K = 1 : length(fn2)
thisfield = fn2{K};
s1.(thisfield) = s2.(thisfield);
end
save('MergedFile.mat', '-struct', 's1');
The output MergedFile.mat will contain all of the variables that were in each of the other two files.
... But I have no idea why you think merging .mat files will be useful in your situation.
  2 Kommentare
Melaku Eneayehu
Melaku Eneayehu am 11 Mär. 2018
thank you sir for your quick answer.am start training multi-class svm, i plan one mat file will contain the label, i try one method that is...i extract feature and save in ,mat file as i mentioned i have 3 classes, and 150 row(extracted feature images) after doing this when i test i try to search similarity on row level, is similarity is close to 1-50 row it falls in to 1st class, if it falls from 51-100 it will falls in to 2nd class...and so on..but the out put is not too good...so i try another training method. i hope you get me....in short i am try training multi-class(3 class) svm based on GLCM and other texture feature totally that have 14 features, after preparing data-set i got difficult in training phase.
Walter Roberson
Walter Roberson am 11 Mär. 2018
Merging mat files is not going to somehow give you better fitting results than the vague "output is not good" that you mention.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Agriculture finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by