How to merge two .mat files?

1 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2018-3-11
编辑:Walter Roberson 2018-3-11
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 个评论
Melaku Eneayehu
Melaku Eneayehu 2018-3-11
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 2018-3-11
Merging mat files is not going to somehow give you better fitting results than the vague "output is not good" that you mention.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Agriculture 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by