help:从 MATLAB gui 将数据记录在 csv 文件中的代码
我是 MATLAB 新手。我有这段代码使用 GUI 提取图像特征。我在创建可以记录提取到 csv 和 txt 文件中的数据的代码时遇到问题。我希望每次将图像加载到 GUI 时,将从图像中提取的数据记录到单个 csv 文件中。这些数据将用于训练神经网络。有人可以帮助我吗? tq
%~~~~~~~~~~~~~~~~~~~~~~~~use when train data~~~~~~~~~~~~~~~~~~~~~
% stt=0; %use it when train data\\set grade value set 1 if pet, set 0 if nonpet
% humoment=[num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(M6) ',' num2str(M7) ',' num2str(perimeter) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar) ',' num2str(stt)];
% Record (humoment,'C:\MATLABDATA\datatrain.csv') %use it when train data
% %~~~~~~~~~~~~~~~~~~~~~~~~use when test data~~~~~~~~~~~~~~~~~~~~~~
humoment=[num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(M6) ',' num2str(M7) ',' num2str(perimeter) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar) ];
data= [filename ',' num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(perimeter) ',' num2str(M6) ',' num2str(M7) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar)];
Record(humoment,'C:\MATLABDATA\datatest.csv')
Record(data,'C:\MATLABDATA\datatest.txt')
set(handles.edit45,'String','Load completed')
end
i'm new to MATLAB. i have this code that extract image feature using gui. i have problem creating a code that can record data extracted into csv and txt file. i want the data extracted from the image to be record into a single csv file each time an image is load into the gui. the data will be use to train a neural network. can some one help me? tq
%~~~~~~~~~~~~~~~~~~~~~~~~use when train data~~~~~~~~~~~~~~~~~~~~~
% stt=0; %use it when train data\\set grade value set 1 if pet, set 0 if nonpet
% humoment=[num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(M6) ',' num2str(M7) ',' num2str(perimeter) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar) ',' num2str(stt)];
% Record (humoment,'C:\MATLABDATA\datatrain.csv') %use it when train data
% %~~~~~~~~~~~~~~~~~~~~~~~~use when test data~~~~~~~~~~~~~~~~~~~~~~
humoment=[num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(M6) ',' num2str(M7) ',' num2str(perimeter) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar) ];
data= [filename ',' num2str(M1) ',' num2str(M2) ',' num2str(M3) ',' num2str(M4) ',' num2str(M5) ',' num2str(perimeter) ',' num2str(M6) ',' num2str(M7) ',' num2str(area) ',' num2str(xbar) ',' num2str(ybar)];
Record(humoment,'C:\MATLABDATA\datatest.csv')
Record(data,'C:\MATLABDATA\datatest.txt')
set(handles.edit45,'String','Load completed')
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的解决方案可能是替换
为
The simplest solution might be to replace
with