在1x6802 double和6802x1 double数据矩阵中,级联矩阵的尺寸不一致 [英] Dimensions of matrices being concatenated are not consistent in 1x6802 double and 6802x1 double data matrix

查看:139
本文介绍了在1x6802 double和6802x1 double数据矩阵中,级联矩阵的尺寸不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Simulink中将m文件信号导出到matfile.我在这里有问题.我的代码是

I want to export m file signal to matfile in simulink. Here I am having a problem. My code is

Y;
X;
T;
K=zeros(1,6802);
for n=1:10:6800;
    angle=atan((Y(n+10)-Y(n))/(X(n+10)-X(n)));
    K(n)=angle;
end
yt=[T;K],
plot(T,K)

错误消息是 使用vertcat时出错 串联的矩阵的尺寸不一致. work1中的错误(第20415行) yt = [T; K],

The error message is Error using vertcat Dimensions of matrices being concatenated are not consistent. Error in work1 (line 20415) yt=[T;K],

这里,K = 1x6802双倍,T = 6802x1双倍.我经历过类似的问题和解决方案,但完全找不到我的答案.如果有人帮助我解决问题,这将非常有帮助.预先感谢.

Here K=1x6802 double and T=6802x1 double. I have gone through similar problems and solution but exactly not found my answer. It would be very helpful if someone helps me in solving the issue. Thanks in advance.

推荐答案

鉴于KT的尺寸,您将必须转置('运算符)以合并成一个新的矩阵:

Given the dimensions of K and T, you will have to transpose (the ' operator) one in order to combine into a new matrix:

yt=[T';K]; % dimensions will be 2x6802

这篇关于在1x6802 double和6802x1 double数据矩阵中,级联矩阵的尺寸不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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