How to save the extracted features of an image in a matfile?
3 次查看(过去 30 天)
显示 更早的评论
I've been trying to save the extracted features of the clusters in a variable in .mat file, but i'm new to matlab and don't know how to deal with .mat files So, there is the code I have wrote, not really sure if it's correct:
0 个评论
回答(1 个)
Adam
2017-5-2
编辑:Adam
2017-5-2
Well, since your question is on saving a mat file, theoretically the rest of the code and problem is not relevant and
doc save
would be your first port of call. In your code you are not giving a filename to the save command. Or rather, since you are using the command form of the syntax it is interpreting what you do give as a filename which will not make sense.
I almost never use command form syntax when function form is available. Just something like
save( 'MyFilename.mat', 'imgsdb', 'IMGDB' )
should work fine. Note the quotes around the variable names. This catches a lot of people (me included, even now sometimes!) out. The variables you want to save are given to the save function as strings giving the variable name, not just passing the raw variable.
2 个评论
Adam
2017-5-2
What are the errors. IMGDB appears to just be a struct so it should save fine, but if it has fancy objects attached to it some of them may potentially cause problems. At a glance, it's fields appear to just be standard types though.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!