how to get an output from the command window into a text file?? plz answer ,its very necessary
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
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
srinivas sri
on 13 Oct 2013
i have tried the same one you sent me , but its saying that its undefined function...
sixwwwwww
on 13 Oct 2013
Have you changed the "filename"?
srinivas sri
on 13 Oct 2013
what file name should i write there..is it the text file i want the answer to be in .. or what ???
dlmwrite('MyCoordinates.txt', M, '\t')
srinivas sri
on 13 Oct 2013
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!
srinivas sri
on 13 Oct 2013
if we are doing like that ,they are coming in a same line ,not row and column wise....
sixwwwwww
on 13 Oct 2013
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
srinivas sri
on 13 Oct 2013
thank u very much........... :)
sixwwwwww
on 13 Oct 2013
You are welcome
More Answers (0)
Categories
Find more on Text Files in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)