matlab读.mat写入txt
Posted wjjcjj
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matlab读.mat写入txt相关的知识,希望对你有一定的参考价值。
问题:
读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 ‘, % name, height, width, left, top, right, bottom, cls_name); outline = [name, ‘;‘, left, ‘;‘, top, ‘;‘, right, ‘;‘, bottom, ‘;‘, cls_name, ‘ ‘]; fprintf(fout, outline); end end fclose(fout);
以上是关于matlab读.mat写入txt的主要内容,如果未能解决你的问题,请参考以下文章
200229(matlab的读文件夹,字符串分割,F1的实现,excel写入加减形式均值方差)