How to "concatenate" an array by merging the elements?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Let's say that I have an array
x = [3,0,0]
Is it possible to somehow manipulate this so that I can output a result of y=300? I am wondering if I can "concatenate" this array such that it outputs a combination of the entire row as a single element or numerical value. So for example if I had
x = [1,0,0 ; 2,0,0 ; 3,0,0]
I would want something that would allow me to output
ans = [100 ; 200 ; 300]
Any help and suggestions are appreciated.
0 Kommentare
Antworten (2)
madhan ravi
am 5 Okt. 2018
x = [1,0,0 ; 2,0,0 ; 3,0,0]
x1 = x(1,:)
x2 = x(2,:)
x3 = x(3,:)
x1=str2num(strcat(num2str(x1(1)),num2str(x1(2)),num2str(x1(3))))
x2=str2num(strcat(num2str(x2(1)),num2str(x2(2)),num2str(x2(3))))
x3=str2num(strcat(num2str(x3(1)),num2str(x3(2)),num2str(x3(3))))
X=[x1;x2;x3]
Would work for any numbers
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!