⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadfile.do.htm

📁 Matlab实现文本文件读取并存储成矩阵源代码
💻 HTM
📖 第 1 页 / 共 4 页
字号:
        </tr>
        



       
          <tr>
            <td><span style="color: white;">Notify me when changes are made to this file</span><br>
                <form name="uForm" method="post" action="/matlabcentral/fileexchange/util.do"><input name="org.apache.struts.taglib.html.TOKEN" value="9bc217962895559b1d7a912ea9432df8" type="hidden">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tbody><tr>
                    <td><span style="color: white;">E-mail:</span></td>
                    <td> <input name="emailAddress" size="10" value="" class="formelem" type="text"> </td>
                  </tr>
                  <tr>
                    <td><img src="loadFile.do_files/spacer.gif" alt="" width="1" height="6"></td>
                    <td><img src="loadFile.do_files/spacer.gif" alt="" width="1" height="6"></td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>
                      <input name="subscribe" value="Notify Me" class="formelem" type="submit">
                    </td>
                  </tr>
                  <tr>
                    <td><img src="loadFile.do_files/spacer.gif" alt="" width="1" height="6"></td>
                    <td><img src="loadFile.do_files/spacer.gif" alt="" width="1" height="6"></td>
                  </tr>
                  <tr>
                    <td colspan="2"><a href="http://www.mathworks.com/matlabcentral/fileexchange/unsubscribe.jsp" onclick="window.open(this.href,'small','toolbar=no,resizable=yes,status=yes,menu=no,scrollbars=yes,width=544,height=300');return false;"><img src="loadFile.do_files/question.gif" alt="" width="11" border="0" height="11">&nbsp;How
                      do I unsubscribe?</a> </td>
                  </tr>

                </tbody></table>
                <input name="objectId" value="10946" type="hidden">
                <input name="objectType" value="file" type="hidden">
                <input name="catId" value="110" type="hidden">
                </form> </td>
          </tr>
          <tr>
            <td class="npad"><img src="loadFile.do_files/ltblue_top_nav_trans.gif" alt="" vspace="0" width="180" height="6"></td>
          </tr>
          
          <tr>
            <td colspan="2">
              <a href="javascript:PopUp('/cgi-bin/page_mail_mlc.cgi?language=en&amp;host=www.mathworks.com&amp;document=www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10946%26objectType=file','page_mail',true)"><img src="loadFile.do_files/mail_brdr.gif" alt="email" width="16" border="0" height="12">
              E-mail this page to <br>
              <span style="padding-left: 18px;">a colleague</span></a>

            </td>
          </tr>
         <tr>
           <td class="npad" valign="top"><img src="loadFile.do_files/dots_rnav.gif" alt="" vspace="0" width="180" height="5"></td>
         </tr>


  </tbody></table>

 </td>
 </tr>
</tbody></table>

</div>
<script type="text/javascript" language="javascript">
<!--
function PopUp(page,title,which)
{
  if (which==true) {
   OpenWin = this.open('/cgi-bin/page_mail_mlc.cgi?language=en&host=www.mathworks.com&document=www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10946%26objectType=file', title, "toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,height=385,width=440");
  } else {
   OpenWin = this.open('/cgi-bin/page_mail_mlc.cgi?language=en&host=www.mathworks.com&document=www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10946%26objectType=file', title, "toolbar=no,menubar=no,location=no,scrollbars=yes,resize=no,height=150,width=300");
  }
}
//-->
</script>

    




      <table id="breadcrmb" width="572" border="0" cellpadding="0" cellspacing="0">
         <tbody><tr>
            <td class="brdcrmbcell" height="20">
            <a href="http://www.mathworks.com/matlabcentral/">MATLAB Central</a> &gt;&nbsp;
            <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do">File Exchange</a> &gt; <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=8&amp;objectType=Category">Utilities</a> &gt; <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=110&amp;objectType=Category">Data Import/Export</a> &gt; readtext 
            </td>
         </tr>
      </tbody></table>



    <div class="mainbody">
    <table style="background-color: rgb(255, 255, 255);" width="536" border="0" cellpadding="0" cellspacing="0">
     <tbody><tr>
      <td>
        <table width="514" border="0" cellpadding="0" cellspacing="0">
          <tbody><tr>
             <td colspan="2"><table width="514" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td class="headercell" width="70%" height="20">&nbsp;readtext&nbsp;
</td><td class="headercell" width="30%" align="right">&nbsp;</td></tr>
<tr><td colspan="2">
<img src="loadFile.do_files/blue_band_536x5.gif" width="536" height="5"></td>
</tr></tbody></table>
</td>
          </tr>
        </tbody></table>
      </td>
      </tr>
    </tbody></table>
    <form name="dnlForm" method="post" action="/matlabcentral/fileexchange/download.do" style="margin-top: 0pt;"><input name="org.apache.struts.taglib.html.TOKEN" value="9bc217962895559b1d7a912ea9432df8" type="hidden">
    <table class="filetable" width="536" border="0" cellpadding="0" cellspacing="0">
      
          
          <tbody><tr>
            <td valign="top" width="10">&nbsp;</td>
            <td><div style="padding-right: 10px;"><b>Download Now:</b></div></td>
            <td><input name="Submit" value=" .m " class="small" type="submit"></td>

          </tr>
          
          <tr>
          <td valign="top" width="10">&nbsp;</td>
            <td valign="top"><b>Rating:</b>
              
            </td>
            <td>

              
              
              

              
		
                 <img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/halfstar.gif" alt="" width="12" height="12" hspace="1">
                

                   <div style="margin-left: 20px; display: inline;">
                   	<a href="http://www.mathworks.com/matlabcentral/fileexchange/loadRatings.do?objectId=10946&amp;objectType=file&amp;all" class="small">
                             
                             	21 reviews</a>
                             
                  &nbsp;&nbsp;<b><a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10946&amp;objectType=file#review_submission" class="small">Review this file</a></b>
            	   </div>
               

            </td>
          </tr>

          
            <tr>
              <td valign="top" width="10">&nbsp;</td>
              <td valign="top"><b>Code Metrics:</b></td>
              <td>

                <table cellpadding="0" cellspacing="0">
                  <tbody><tr>
                    <td width="75">
                      <table border="0" cellpadding="0" cellspacing="1">
                        <tbody><tr>
                          <td><img src="loadFile.do_files/00th.png" title="Complexity (4th percentile, raw score: 60)" width="11" border="0" height="10"></td>
                          <td><img src="loadFile.do_files/90th.png" title="M-Lint (100th percentile, raw score: 0.0)" width="11" border="0" height="10"></td>
                          <td><img src="loadFile.do_files/90th.png" title="Help (100th percentile, raw score: 0.0)" width="11" border="0" height="10"></td>
                          <td><img src="loadFile.do_files/90th.png" title="Clash (100th percentile, raw score: 0)" width="11" border="0" height="10"></td>
                          <td><img src="loadFile.do_files/90th.png" title="Cloned (100th percentile, raw score: 0)" width="11" border="0" height="10"></td>
                        </tr>
                      </tbody></table>
                    </td>
                    <td>
                      <div style="margin-left: 10px; display: inline;">
                        <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10946&amp;objectType=scoreDetails" class="small">Full report</a>&nbsp;&nbsp;
                      </div>
                      <br>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2">
                      <img src="loadFile.do_files/question.gif" alt="" width="9" border="0" height="11">&nbsp;<a href="http://www.mathworks.com/matlabcentral/fileexchange/codeMetricsPopup.jsp" onclick="window.open(this.href,'small','toolbar=no,resizable=yes,status=yes,menu=no,scrollbars=yes,width=571,height=450');return false;" class="small">What is this?</a>
                    </td>
                  </tr>
                </tbody></table>

              </td>
            </tr>
          


          
          <tr>
            <td valign="top" width="10">&nbsp;</td>
            <td valign="top" width="89"><b>Author:</b></td>
            <td colspan="2"><a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&amp;objectId=1095046">Peder&nbsp;Axensten</a></td>
          </tr>
          <tr>
            <td valign="top" width="10" height="15">&nbsp;</td>
            <td valign="top" width="89" height="15"><b>Summary:</b></td>
            <td colspan="2" height="15">Any text (file) you give it, readtext returns an array of the contents. You can chose delimiter etc.</td>
          </tr>
          <tr>
            <td valign="top" width="10" height="15">&nbsp;</td>
            <td valign="top" width="125" height="15"><b>MATLAB Release:</b></td>
            <td colspan="2" valign="bottom" height="15">R13SP1</td>
          </tr>

          

          

          

         

          <tr>
            <td valign="top" width="10">&nbsp;</td>
            <td valign="top" width="135"><b>Description:</b></td>
            <td class="lnwrp" width="456">
            Usage: [data, result]= readtext(source, delimiter, comment, quotes, options) <br>
 <br>
Whatever text (file) you give it, readtext returns an array of the
contents (or send me a bug report). Matlab can't read variable length
lines or variable type values with the standard library. readtext can
read any text file. Any string (or even regexp) can be delimiting,
default is a comma. Everything after (and including) a comment
character, until the line end, is ignored. Quote characters may also be
given, everything between them is treated as one item. There are
options to control what will be converted to numbers and how empty
items are saved. <br>
 <br>
If you find any errors, please let me know: peder at axensten dot se. <br>
 <br>
source: the file to be read. May be a file path or just the file name. OR: The text itself, see 'textsource', below. <br>
 <br>
delimiter: (default: ',') any non-empty string. May be a regexp, but this is slow on large files. <br>
 <br>
comment: (default: '') zero or one character. Anything after (and
including) this character, until the end of the line, will be ignored. <br>
 <br>
quotes: (default: '') zero, one (opening quote equals closing), or two
characters (opening and closing quote) to be treated as paired braces.
Everything between the quotes will be treated as one item. The quotes
will remain. Quotes may be nested. <br>
 <br>
options: (default: '') may contain (concatenate combined options): <br>
- 'textsource': source contains the actual text to be processed, not the file name. <br>
- 'textual': no numeric conversion ('data' is a cell array of strings only), <br>
- 'numeric': everything is converted to a number or NaN ('data' is a
numeric array, empty items are converted to NaNs unless 'empty2zero' is
given), <br>
- 'empty2zero': an empty field is saved as zero, and <br>
- 'empty2NaN': an empty field is saved as NaN. <br>
- 'usewaitbar': call waitbar to report progress. If you find the wait bar annoying, get 'waitbar alternative' at <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11398" target="_blank">http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11398</a> <br>
 <br>
data: A cell array containing the read text, divided into cells by
delimiter and line endings. 'data' will be empty if the file is not
found, could not be opened, or is empty. With the option 'numeric',
'data' will be a numeric array, with 'textual', 'data' will be a cell
array of strings only, and otherwise it will be a mixed cell array. For
Matlab &lt; version 7, returned strings may contain leading
white-space. <br>
 <br>
result: a structure: <br>
.min: minimum number of columns found in a line. <br>
.max: number of columns in 'data', before removing empty columns. <br>
.rows: number of rows in 'data', before removing empty rows. <br>
.numberMask: true, if numeric conversion ('NaN' converted to NaN counts). <br>
.number: number of numeric conversions ('NaN' converted to NaN counts). <br>
.emptyMask: true, if empty item in file. <br>
.empty: number of empty items in file. <br>
.stringMask: true, if non-number and non-empty. <br>
.string: number of non-number, non-empty items. <br>
.quote: number of quotes. <br>
 <br>
EXAMPLE 1: [a,b]= readtext('txtfile', '[,\t]', '#', '"', 'numeric-empty2zero') <br>
This will load the file 'txtfile' into variable a, treating any of tab
or comma as delimiters. Everything from and including # to the next
newline will be ignored. Everything between two double quotes will be
treated as a string. Everything will be converted to numbers and a
numeric array returned. Non-numeric items will become NaNs and empty
items are converted to zero. <br>
 <br>
EXAMPLE 2: a= readtext('The, actual, text, to, process', ',', '', '', 'textsource') <br>
This will process the actual text string, returning a cell string of the five words. <br>
 <br>
COPYRIGHT (C) Peder Axensten (peder at axensten dot se), 2006-2007.  <br>
            </td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -