how to delcare a 2 dimensional array in matlab?

43 Ansichten (letzte 30 Tage)
bubble  trouble
bubble trouble am 28 Dez. 2011
heyy i am trying to declare an 2D array in c++ it was easy like: array[i][j]= value i want to assign but in matlab how is it possible? i want to store two values against one field...
  1 Kommentar
Jan
Jan am 28 Dez. 2011
I've remove the "urgent" in the title and the tag. It does not increase the probability to get an answer. In contrary, it is counter-productive in this (ans other) forums.
What does this mean exactly: "I want to store two values against one field" ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 28 Dez. 2011
array(i,j) = value;
  1 Kommentar
Matt Tearle
Matt Tearle am 28 Dez. 2011
That. And if you want to preallocate space (which you should, if you have arrays that may grow significantly in loops):
array = zeros(m,n);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Jan
Jan am 28 Dez. 2011
This is a very basic question. This forum shall not be a replacement of reading the "Getting Started" chapters of the documentation.
If it is "urgent", it must be serious. If it is serious, there must be enough time to read the documentation.

Walter Roberson
Walter Roberson am 28 Dez. 2011
MATLAB does not have declarations, only assignments and references.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by