How to merge two .mat files?
2 ビュー (過去 30 日間)
古いコメントを表示
Melaku Eneayehu
2018 年 3 月 11 日
コメント済み: Walter Roberson
2018 年 3 月 11 日
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.
0 件のコメント
採用された回答
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 件のコメント
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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!