how to initialize array

339 次查看(过去 30 天)
cse batch4
cse batch4 2015-3-19
编辑: Rik 2021-10-7
hi friends how to initialize array in matlab
  2 个评论
roxnvols
roxnvols 2020-8-31
For those looking to initalize a 1D array of specific length mxn and value x:
x.*ones(m,n)
Enjoy the non condenscending answer!
Walter Roberson
Walter Roberson 2020-8-31
ones(m,n) would produce a 2D array unless one or both of m or n are 1

请先登录,再进行评论。

回答(1 个)

Guillaume
Guillaume 2015-3-19
编辑:Rik 2021-10-7
Going through the very first tutorial in the documentation would have told you that. Or the introduction of any book on matlab.
This is the very basics of matlab.
Edit (by @Rik):
Since the link above is to the then-newest R2015a release, the link is no longer working as intended. This link should keep working (unless Mathworks decides to move/split the page in a future release).
  2 个评论
Walter Roberson
Walter Roberson 2019-10-4
Alexander Daniels comments:
Did not answer the question, and instead opted to be condescending
Walter Roberson
Walter Roberson 2019-10-4
Alexander:
The link provided was directly to material that shows the initialization of matrices, and so does answer the question.
There is no requirement in this MATLAB Answers facility that the volunteers answer in their own words or copy copyrighted material: it is acceptable for the volunteers to post links to the desired information -- or, for that matter, even just links to entire groups of discussion of the topic where the solution is "somewhere" in the group.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by