MATLAB: Displaying in command winodw but i need to store in .txt file

randomtext file

Hello
In a code I have a random 20000 data sequence ranging form 0 to 255, I am displaying the locations of each data they occurred in a matlab code in command window such that
for i=0:1:255
i
locations=find(X==i)% finding the locations of same number in the randomly genarated vector
% X is my random generated sequence of 20000 data
I am getting output in command window such that
i =
134
locations =
Columns 1 through 10
402 802 846 1476 2101 2293 2322 2594 3408 3444
that is 134 occurs in such positions of random sequence
but due to huge no of data the complete list is not available on command window i am getting data from i=125 the rest of data are hiding some where in command window,,how can I put this i and locations in a separate notepad file.. regards

Best Answer

You could use diary:
doc diary
Or fopen/fprintf/fclose