M HYPE SPLASH
// news

Displaying large matrices in matlab with pause when screen is filled?

By Emma Payne
$\begingroup$

Is there a function to display large array on command prompt with displaying only part of it and waiting until user enters something from keyboard.

$\endgroup$ 1

1 Answer

$\begingroup$

There is no equivalent to the *nix more flag, sadly.

The quickest fix is to do the following:

k = 8; %number of columns to display
l = 20; %number of rows to display
for i=i:k:size(A,2) for j = 1:l:size(A,1) A(j:j+l,i:i+k) input(''); end
end

Which will page the matrix row-wise first, then column-wise (swap the loops if you want the opposite).

You may also need to put in conditionals to handle index out of bounds, etc. but I chose not to clutter the code with that.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy