【问题标题】:Transform array in matrix MATLAB在矩阵MATLAB中变换数组
【发布时间】:2015-02-11 00:58:12
【问题描述】:

我有一个很长的数组 matlab,我必须将其转换为矩阵。 我每天都有 1440 个值(每天的分钟数)。 在我的模拟中,我获得了一个 1440*N 的数组,其中 N 是天数。 现在我需要得到一个N行1440列的矩阵,以便分析数据...

我使用 reshape 命令,但它不起作用。

有什么想法吗?

【问题讨论】:

  • 转置是否足够,或者您需要重新排列数据?
  • 为什么重塑不起作用?你得到什么错误?

标签: arrays matlab matrix reshape


【解决方案1】:
MatA=reshape(ArrayA,N,1440);

应该可以。你是这样用reshape()的吗?

【讨论】:

  • 我有这个错误:错误使用重塑要重塑元素的数量不能改变。这是我的命令:poseforday=reshape(posture,total_days_simulation,round(length(posture)/total_days_simulation));
  • 该错误意味着length(posture) 不等于total_days_simulation*round(length(posture)/total_‌​days_simulation)。这是因为您的 round() 正在改变元素的数量,实际上他们甚至不应该首先需要它。确保您的模拟天数和分钟数保持一致
  • 使用:poseforday=reshape(posture,total_days_simulation,[]);
  • 另外,我猜你可能想要转置ArrayA。所以,最终的矩阵将是reshape(ArrayA.', N, [])
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-24
  • 2015-07-26
相关资源
最近更新 更多