Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- matrix = [
- 0 2 4 6 8 10
- 1 3 5 7 9 11
- 12 14 16 18 20 22
- 13 15 17 19 21 23
- ];
- new = new_array(matrix,4);
- disp (new)
- function b = new_array(a,n)
- if n >= 0 && n <= length(a)
- b = a(1:n,size(a,2)-n:size(a,2));
- elseif n <= 0
- msg = 'Wielkosc wyekstrahowanej macierzy musi byc wieksza od 0!';
- error(msg);
- else
- msg = 'Podana wartosc przekracza wielkosc wejsciowej macierzy!';
- error(msg);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement