conversion
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
how can we convert scalar to vector
0 Kommentare
Akzeptierte Antwort
Paulo Silva
am 24 Apr. 2011
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
0 Kommentare
Weitere Antworten (2)
Walter Roberson
am 24 Apr. 2011
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))
0 Kommentare
Oleg Komarov
am 24 Apr. 2011
I think he intends to repmat the scalar.
1 Kommentar
Walter Roberson
am 24 Apr. 2011
Considering the other active questions by the user, I doubt that myself.
Siehe auch
Kategorien
Mehr zu Characters and Strings 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!