【问题标题】:How to open file in MATLAB?如何在 MATLAB 中打开文件?
【发布时间】:2016-10-09 00:31:32
【问题描述】:

我确保该文件存在于代码所在的位置。

text = fopen(string.txt,'r')

错误:

>> Phy_rate_box_plot
Undefined variable "string" or class "string.txt".

Error in Phy_rate_box_plot (line 4)
text = fopen(string.txt,'r')

【问题讨论】:

    标签: string matlab file fopen readfile


    【解决方案1】:

    如果您检查fopen documentation,您会看到filename 应该是字符串或字符数组。要使 string.txt 成为字符串,只需将其括在单引号中

    text = fopen('string.txt','r')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      • 2016-02-15
      • 2023-04-06
      • 1970-01-01
      • 2012-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多