A = 'We Are!'
B = [1 4; 3 2]
C = 'Penn State!'
D = single([ 1 2; 3 4])
E = {A, B, C, D} %default printing, just shows sizes.
celldisp(E) %needed to generate display
E{3} {{fa-arrow-right}} displays 'Penn State'
E{1}(1,2) %1st row, 2nd col of cell 1 w/ multilayer indexing {{fa-arrow-right}} displays e
E{2}(:) %concatenates cell 2 into column vector
N.first = 'Hello';
N.second = 'World';
disp('N is: ')
disp(N) {{fa-arrow-right}} N is: first:'Hello'; second:'World'
orderfields(N) %orders fields in ASCII dictionary
orderfields(N,O) %orders N field like O is ordered
T = 'myphrase1';
L = rmfield(L,T) % removes 'myphrase1' field from L
nrows = 3;
ncols = 2;
npages = 4;
B = zeros(nrows,ncols,npages);
counter = 25;
for k = 1:npages;
for i = 1:nrows;
for j = 1:ncols;
counter = counter - 1;
B(i,j,k) = counter;
end
end
end
fprintf('The first page of B is:\n')
disp(B(:,:,1))
etc
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.