MATLAB: Why always fopen fails fopentext file in_file = fopen('name_of_file', 'wt'); It is my code i used to open a file .but it always return file identifier as -1.Why? Thank you for help. Best Answer Most likely you do not have write permissions in the current folder. Use a folder with write permissions and absolute file names:in_file = fopen(fullfile(tempdir, 'name_of_file'), 'wt'); Related SolutionsMATLAB: How to use uigetfile to open subfolder’s file. [file,filepath] = uigetfile('*.txt');if isempty(file); return; end %user cancelfullname = fullfile(filepath, file);WISETEST = fopen( fullname, 'rt');out = textscan(WISETEST, '%s', 'Delimiter',{' '});fclose(WISETEST);aa = out{1}(1:end)'; MATLAB: Acos fails (x*v-y*u)/H is equal to 1It is probably a bit greater than 1, because of floating-point approximation error. Thus the complex result. Related QuestionA question about function — uigetfile()Add directory path to fopenHow to delete a particular row in multiple TXT filesThe text file is always not opened when i use fopen!!Open multiple files with fopen
Best Answer