conversion

17 ビュー (過去 30 日間)
mahaveer hanuman
mahaveer hanuman 2011 年 4 月 24 日
how can we convert scalar to vector

採用された回答

Paulo Silva
Paulo Silva 2011 年 4 月 24 日
In MATLAB a "scalar" is a vector with just one element, for example [1] is the same as 1
here's a sneaky way to separate all the digits of a scalar into columns of a vector
nc=1010; %my scalar value
nv=num2str(n)-'0' %my vector

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 4 月 24 日
If S is your scalar, you can use any of the following:
reshape(S,1,[])
reshape(S,[],1)
S(:)
S.'
S(end) = S;
kron(S,1)
full(sparse(S))

Oleg Komarov
Oleg Komarov 2011 年 4 月 24 日
I think he intends to repmat the scalar.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 4 月 24 日
Considering the other active questions by the user, I doubt that myself.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by