码迷,mamicode.com
首页 > 其他好文 > 详细

matlab读.mat写入txt

时间:2020-02-24 14:45:32      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:load   outline   otto   图片   ima   open   一个   class   line   

问题:

读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

标签:load   outline   otto   图片   ima   open   一个   class   line   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!