New to Matlab and GUI - load and plot data from txt data file

조회 수: 1 (최근 30일)
George  Makropoulos
George Makropoulos 2016년 5월 27일
편집: Joseph Cheng 2016년 5월 29일
I have a txt data file,i have made it B matrix of 2 columns and i want this file to load in gui(push button) and then plot these 2 columns (push button 2) how i do this? i managed to load file on gui with following code
[filename, pathname] = uigetfile({'*.txt'},'Open Directory');
if isequal(filename,0) || isequal(pathname,0)
return
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2016년 5월 29일
George - you will need to post more of your code. Is the above being called from within a callback of your GUI? How are you getting the B matrix of two columns? Please clarify.
Joseph Cheng
Joseph Cheng 2016년 5월 29일
편집: Joseph Cheng 2016년 5월 29일
Your code snippet doesn't load in any file. Here uigetfile just gets the folder and file name you've selected. You'll need to use either dlmread(), csvread(), fopen(), etc. to actually read in the data.
You can read up on those functions and determine whats the one that is best suited for your text file. After you've figured out how to import the file into a variable. I'd suggest looking at the sample guide template "GUI with Axes and Menu" (specifically the pushbutton1 callback).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by