필터 지우기
필터 지우기

how can fix this problem with matrix ?

조회 수: 1 (최근 30일)
Mira le
Mira le 2019년 10월 28일
댓글: Adam Danz 2019년 10월 30일
How can I create matrix with the size N,m?
How can I copy each array of matrix in a vector and make the modification in it
and the replace again in the matrix?
Example
vector = M (1,:)
after modification of the vector
M(1,:) = vector
But an error appear " Index exceeds matrix dimensions."
  댓글 수: 4
Mira le
Mira le 2019년 10월 30일
the size of matrix M is N = 10 and m = 4
M = 1 2 0 3
0 0 3 5
6 4 2 0
.
.
N
vector = M(1,:)
vector = 1 2 0 3
appear the error
Adam Danz
Adam Danz 2019년 10월 30일
vector = M (1,:)
% Somewhere between these two lines your vector is changing in one
% of the following 2 ways:
% 1) it's length is changing
% 2) it is converted to a column vector instead of a row vector
% 3) an additional row is added to the vector making it a matrix
M(1,:) = vector

댓글을 달려면 로그인하십시오.

답변 (1개)

Sai Bhargav Avula
Sai Bhargav Avula 2019년 10월 30일
Hi, May be after modification you vector became a column vector. Try
M(1,:) = vector';
If this doesn't work, provide the value of size(vector).
Hope this helps!

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by