Read text file and store in .mat file
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
채택된 답변
  dpb
      
      
 2013년 8월 24일
        data=importdata('yourfile.txt');
Use the data as is...
doc save % and friends to write/read .mat files...
If the data in the text file contain more formatting, etc., than just the simplest, then
doc textscan % and friends
help iofun
will give a list of all the choices (a veritable plethora from which to choose depending on what you have as the input format).
댓글 수: 4
  shuchita bahadur
 2016년 12월 28일
				when usinf importdata in Command line it works, not from within a script. The variable does'nt show in workspace.
  dpb
      
      
 2016년 12월 28일
				In a script is the same as at the command line. If you mean a function m-file, yes, variables are local in scope within functions; to return the variable to the calling scope (command line or calling function), that function must have a return variable and the result of the read operation, whatever routine you use, returned to the caller via that variable.
See
doc function
for how functions work...
추가 답변 (1개)
  dwarose
 2013년 8월 24일
        etc., than just the simplest, then doc textscan % and friends help iofun will give a list of all the choices (a veritable plethora from which to choose depending on what you have as the input formatUse the data as is... doc save % and friends to write/read .mat files... If the data in the text file contain more formatting,  http://justintv-fenerbahce-eskisehirspor-maci-canli-seyret.blogs.lalibre.be/
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



