简体   繁体   English

倍频程加载功能

[英]octave load function

i'm trying to load a mat file from a subdirectory using the following code: 我正在尝试使用以下代码从子目录加载Mat文件:

% filename_str is read from a text file
directoryname_str = "./data";
f = fullfile(directoryname_str, filename_str);
load(f);

when i run this sequence, load says it can't find the file...but when i copy or type the relative path and the file name by hand into an active octave session, everything works like a champ with no errors. 当我运行此序列时,load表示找不到文件...但是当我手动复制或键入相对路径和文件名到活动的八度音程时,一切都像冠军一样,没有错误。

i assume this has something to do with how octave searches for mat files? 我认为这与八度搜索Mat文件的方式有关? if so, what's the correct environment variable or function call i need to make in order for this code to work? 如果是这样,为了使此代码正常工作,我需要进行哪些正确的环境变量或函数调用?

thanks! 谢谢!

  1. Are you sure that what you put into the variable f is the same as what you input manually in octave? 您确定输入到变量f中的内容与在八度中手动输入的内容相同吗?

  2. Are you also in the same directory? 您是否也在同一目录中? Because you're specifying relative paths, this should be the case.. you can get the current directory octave is in with pwd 因为您正在指定相对路径,所以应该是这样。.您可以使用pwd获取当前目录八度。

  3. And last of all, you can double check file existence in octave itself using exist 最后,您可以使用exist再次检查八度音阶中文件的存在

     exist(f,'file') 

    If this returns false, there's definitely something wrong with your current directory, are something's very weird going on.. 如果返回false,则表明当前目录肯定存在问题,这是很奇怪的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM