Path: blob/master/Week 2/Octave Tutorial/2. Moving Data Around/moving_data_around.txt
625 views
octave:2> A = [ 1 2; 3 4; 5 6]1A =231 243 455 667octave:3> x = size(A);8octave:4> x9x =10113 21213octave:5> size(x)14ans =15161 21718octave:6> size(A,1)19ans = 320octave:7> size(A,2)21ans = 222octave:8> pwd23ans = C:\Users\amlan24octave:9> cd 'C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\Moving Data Around'25octave:10> ls26Volume in drive C has no label.27Volume Serial Number is FA5E-CC302829Directory of C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\Moving Data Around3031[.] [..]320 File(s) 0 bytes332 Dir(s) 173,247,627,264 bytes free34octave:11> ls35Volume in drive C has no label.36Volume Serial Number is FA5E-CC303738Directory of C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\Moving Data Around3940[.] [..] featuresX.dat priceY.dat412 File(s) 150 bytes422 Dir(s) 173,247,623,168 bytes free43octave:12> load featuresX.dat44octave:13> load pri45priceY.dat print print_struct_array_contents printd prism46primes print_empty_dimensions print_usage printf47octave:13> load priceY.dat48octave:14> who49Variables in the current scope:5051A ans featuresX priceY x5253octave:15> featuresX54featuresX =55562103 2572204 2582205 2593500 3601450 1612100 1624000 3634400 3642800 2655000 4663400 26768octave:16> size(featuresX)69ans =707111 27273octave:17> size(priceY)74ans =757611 17778octave:18> whos79Variables in the current scope:8081Attr Name Size Bytes Class82==== ==== ==== ===== =====83A 3x2 48 double84ans 1x2 16 double85featuresX 11x2 176 double86priceY 11x1 88 double87x 1x2 16 double8889Total is 43 elements using 344 bytes9091octave:19> v = priceY(1:5)92v =9394220095440096230097300098450099100octave:20> save hello.mat101octave:21> save hello.mat v102octave:22> save hello.txt v -ascii #saves in ascii format103octave:23> A = [1 2; 3 4; 5 6]104A =1051061 21073 41085 6109110octave:24> % A 2111octave:24> A (3,2)112ans = 6113octave:25> A(2,:)114ans =1151163 4117118octave:26> A(:,2)119ans =120121212241236124125octave:27> A ([1 3], :)126ans =1271281 21295 6130131octave:28> A(:,2) = [10; 11; 12] #Assigning values to 2nd col132A =1331341 101353 111365 12137138octave:29> A(:) #put all elements of A into a single vector139ans =140141114231435144101451114612147148octave:30> B = [20 21; 22 23; 24 25]149B =15015120 2115222 2315324 25154155octave:31> C = [A B]156C =1571581 10 20 211593 11 22 231605 12 24 25161162octave:32> C = [A; B]163C =1641651 101663 111675 1216820 2116922 2317024 25171172