how to get an output from the command window into a text file?? plz answer ,its very necessary

i have a set of coordinates which i got after processing an image ,now i want to those coordinates in form a text file to apply them as an input to another application,,,..

 Accepted Answer

Dear Srinivas Sri, for example you have coordinates in the form of 'x' and 'y' array then you can write it in a text file using "dlmwrite" function like this:
x = 1:20;
y = 2:2:40;
M = [x' y'];
disp(M)
dlmwrite(filename, M, '\t')

10 Comments

i have tried the same one you sent me , but its saying that its undefined function...
what file name should i write there..is it the text file i want the answer to be in .. or what ???
thank u very much...its working.. just out of curiosity - what if i want the matrix in a text file in matrix form itself.......
For matrix you can do the same. Just save all the values in a matrix (e.g. M) and then use:
dlmwrite('MyCoordinates.txt', M, '\t')
Also accept this answer to help others find solution of similar question. Good luck!
if we are doing like that ,they are coming in a same line ,not row and column wise....
If you will open your file in "Notepad" then you will not see the actual matrix form but if you will open your file in "WordPad" or "Microsoft Word" then you can see it in matrix form

Sign in to comment.

More Answers (0)

Tags

Asked:

on 13 Oct 2013

Commented:

on 13 Oct 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!