formal initialisation of matrix

조회 수: 1(최근 30일)
Julien 2014년 4월 9일
답변: Julien 2014년 4월 10일
I would like to know if it's possible to create a matrix A by giving the value of every coefficient A(i,j). Something like that :
A(i,j) = i+j
I would like to do this directly when the matrix is created, not using the double for i, for j.
Thankyou for your answer,

채택된 답변

lvn 2014년 4월 10일
Answering your second question

추가 답변(4개)

Titus Edelhofer
Titus Edelhofer 2014년 4월 9일
Hi Julien,
often you can use the function meshgrid for this...

lvn 2014년 4월 9일
Three alternative solutions posted here:

Julien 2014년 4월 9일
Thankyou for your rapid answer, it helps me a lot =)
Now if it's possible, I would like to construct a matrix of booleans based on the same idea but with :
A ( i , j ) = ( x(i) == y(j) )
with x and y known vector.
If somebody has idea..
Thanks a lot,

Julien 2014년 4월 10일
Perfect answer thankyou it's okay =)

Community Treasure Hunt

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

Start Hunting!

Translated by