使用负载时出错;无法读取文件Matlab [英] Error using load; Unable to read file matlab

查看:748
本文介绍了使用负载时出错;无法读取文件Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开一个对话框,提示用户选择一个文件,然后在为名为EEGLAB的matlab工具箱编写的函数中使用该文件.代码如下:

I am trying to open a dialog box that prompts the user to select a file and then using that file in a function written for a matlab toolbox called EEGLAB. The code is as follows:

[F,PathName,FilterIndex] = uigetfile({'*.*','All Files(*.*)'}, 'Select your File ')
b = strcat(PathName,F)
Input = importdata(b)
FF = Input.filename;
%Loading the dataset into EEG lab. and rereferencing to Cz. 
EEG = pop_loadset('filename','FF','filepath','/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01 and lance01 ref Fz - TF Analysis - all electrodes/');
EEG = eeg_checkset( EEG );

我遇到的问题在此行:

EEG = pop_loadset('filename','FF','filepath','/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01 and lance01 ref Fz - TF Analysis - all electrodes/');

这是我收到的错误消息:

and this is the error message I get:

使用加载时出错 无法读取文件'/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01和lance01参考Fz-TF 分析-所有电极/FF':无此文件或目录. pop_loadset中的错误(第108行) TMPVAR = load('-mat',文件名); newrereference中的错误(第7行) EEG = pop_loadset('filename','FF','filepath','/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01 和lance01 ref Fz-TF分析-所有电极/');

Error using load Unable to read file '/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01 and lance01 ref Fz - TF Analysis - all electrodes/FF': no such file or directory. Error in pop_loadset (line 108) TMPVAR = load('-mat', filename); Error in newrereferencing (line 7) EEG = pop_loadset('filename','FF','filepath','/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01 and lance01 ref Fz - TF Analysis - all electrodes/');

现在,如果我不从头开始执行弹出对话框窗口(这意味着我删除了已有的前4行代码,而在接下来的行中则删除了:

Now if I don't do the popup dialog window in the beginning (meaning I delete the first 4 lines of code I have and in the following line I have:

  EEG = pop_loadset('filename','206301L01.set','filepath','/Users/maheensiddiqui/Desktop/eeglab13_4_4b/EEG_data/Data/infant control01

和lance01 ref Fz-TF分析-所有电极/');

and lance01 ref Fz - TF Analysis - all electrodes/');

即我明确声明了文件名,其余代码工作正常.我不确定为什么会这样...我需要为大约20个不同的文件运行我的代码,如果每次都需要键入该名称才能使其正常工作,它的效率将非常低! (特别是如果我要与他人共享我的代码).

i.e. I explicitly state the name of the file, the rest of the code works fine. I am not sure why this is happening... I need to run my code for about 20 different files and its very inefficient if the name needs to be typed in each time for it to work! (Especially if I will be sharing my code with other people).

有人知道为什么我会出现此错误吗?可能是由于文件格式引起的吗? .set,而不是.mat或.txt等常规格式.但是.set格式在显式放置文件名时有效.我还更改了目录以排除空格,但这也不起作用...

Does anyone know why I might be getting this error? Could it be because of the file format? .set rather than a conventional format like .mat or .txt or whatever. But the .set format works when the filename is put in explicitly. I have also changed my directory to exclude spaces but that doesn't work either...

我将不胜感激!

推荐答案

感谢Hoki的评论,我得以解决此问题.当它是一个变量时,我是以字符串形式输入文件名的.

Thanks to Hoki's comment I was able to solve the problem. I was inputting the filename as a string when it was a variable.

EEG = pop_loadset('filename',FF,'filepath',...)使用FF而没有'FF'用作变量,这是一个固定的问题.

EEG = pop_loadset('filename',FF,'filepath',...) using FF without 'FF' used it as the variable it was an fixed the problem.

感谢Hoki.

这篇关于使用负载时出错;无法读取文件Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆