unknown numbers of input

3 次查看(过去 30 天)
khoirul hadi
khoirul hadi 2015-10-15
编辑: Guillaume 2015-10-15
let say i have M X N matrix, and i want to split it based on its number of rows, example below is 3X5 matrix, so how can i get M variables (x,y,z) without knowing the number of M?
Matrix A became arrays :
1 1 1 1 1 x = 1 1 1 1 1
2 2 2 2 2 => y = 2 2 2 2 2
3 3 3 3 3 z = 3 3 3 3 3

回答(2 个)

Thorsten
Thorsten 2015-10-15
Creating dynamically named variables should be avoided. Just use
A(i,:)
to get you desired vectors.
  1 个评论
Guillaume
Guillaume 2015-10-15
编辑:Guillaume 2015-10-15
Indeed. Maybe if khoirul explained his use case, we can explain why his question is a bad idea.

请先登录,再进行评论。


Image Analyst
Image Analyst 2015-10-15

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by