首页 > 其他 > 详细

matlab读.mat写入txt

时间:2020-02-24 15:01:22      阅读:106      评论:0      收藏:0      [点我收藏+]

问题:

读VehicleInfo.mat里面的数据,存入一个.txt文件中

技术分享图片

代码:

load(VehicleInfo.mat);
sz = size(VehicleInfo);
nums = sz(1);

anno = VehicleInfo;
fout=fopen(bit_vehicles_anno.txt, w);
for i=1:nums
    name = anno(i).name;
    height = anno(i).height;
    width = anno(i).width;
    vehicles = anno(i).vehicles;
    nVehicles = anno(i).nVehicles;
    for j=1:nVehicles
        left = num2str(vehicles(j).left);
        top = num2str(vehicles(j).top);
        right = num2str(vehicles(j).right);
        bottom = num2str(vehicles(j).bottom);
        cls_name = vehicles(j).category;
        %fprintf(fout, %s;%d;%d;%d;%d;%d;%d;%s\n,
        %    name, height, width, left, top, right, bottom, cls_name);
        outline = [name, ;, left, ;, top, ;, right, ;, bottom, ;, cls_name, \n];
        fprintf(fout, outline);
    end
end
fclose(fout);

 

matlab读.mat写入txt

原文:https://www.cnblogs.com/wjjcjj/p/12356839.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!