Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
For future reference: usage questions of (matlab), while on topic here, can often receive better/quicker attention (looking at the questions tagged ¨matlab¨, Ed Gorcenski´s quick and informative answer is unfortunately not yet the norm for such questions) if you ask somewhere like MatLab Central. (And who knows, maybe asking this question there would prompt them to code in such a feature.) –  Willie Wong Sep 5 '12 at 14:08

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.