How do I load text files into the GUI workspace?

I have a GUI in which I am trying to load data (from a txt file) from the directory in which the GUI code is at. I will also be manipulating this data within the GUI also.
I have tried the simple load command within the GUI code, but that does not work.
I am thinking of adding buttons and using uigetfile to load the files, but that isn't as discrete as I would like it to be.

4 Kommentare

Jan
Jan am 29 Nov. 2012
Bearbeitet: Jan am 30 Nov. 2012
What have you tried exactly? Posting the relevant part of the code will reveal this. And what does "does not work" mean? We can neither guess such details, nor suggest an improvement based on this information.
Jan
Jan am 30 Nov. 2012
Deleting questions demotivates uers to invest time in formulating answers. So please stop doing this.
Randy Souza
Randy Souza am 30 Nov. 2012
Hamza, could you please explain why you would like this question deleted? Your solution may be useful to other people in the future.
You mention that you used a simpler way--please post that as an additional answer to the question.
I have restored the original text of this question.
Hamza, this question has a clear subject and multiple answers (including yours), so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please add a comment explaining why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Arthur
Arthur am 29 Nov. 2012
Bearbeitet: Arthur am 29 Nov. 2012

0 Stimmen

You can get the path to your mfile with mfilename and fileparts:
fname = mfilename('fullpath');
fdir = fileparts(fname);

2 Kommentare

Hamza
Hamza am 29 Nov. 2012
I figured it out, I used a simpler way. Thank you.
Jan
Jan am 29 Nov. 2012
@Hamza: The idea of this forum is to share problems and their solutions with other. Deleting a question after you find a solution does not support this. To encourage users to help you in the future also, it would be more helpful, if you post your solution instead.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 29 Nov. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by