如何克服在MATLAB中写入CSV文件时的尺寸不匹配? [英] How to overcome dimension mismatch for writing to a CSV file in MATLAB?

查看:772
本文介绍了如何克服在MATLAB中写入CSV文件时的尺寸不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经计算出一个4 * 4矩阵的图像的特征。我提取这些功能的21图像(同一个人,但21不同的姿势)。我现在要将这些功能存储到带有标签+1的CSV文件中。我尝试使用

I have calculated features of an image which is a 4*4 matrix. I extract these features for 21 images(same person but 21 different poses) . I now want to store these features into a CSV file with labels +1. I try to do that using

features=ctsfeatures(inputdata); %inputdata is an array of 21 images                                                                                              
for i=1:length(features)                                                
   for j=1:1
       label(i,j)=+1;
   end
end

csvwrite('fea.csv',[label features]);    

但是我得到以下错误:

Horzcat dimension mismatch in line csvwrite('fea.csv',[label features]);     

请告诉我如何克服这个错误。提前提醒。

Please tell me how to overcome this error.Thanks in advance.

推荐答案

由于您的地图项大小 4 * 4 ,所以您需要有< $ c> 4 * 4

Since your features is of size 4*4, you need to have label of size 4*4

features=ctsfeatures(inputdata); %inputdata is an array of 21 images                                                                                              
for i=1:size(features,1)                                                
   for j=1:size(features,2)
      label(i,j)=+1;
   end
end

csvwrite('fea.csv',[label features]);  

这篇关于如何克服在MATLAB中写入CSV文件时的尺寸不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆