フィルターのクリア

hi all, I am trying to open a file with .001 extension , fopen gives error. can you please help?

6 ビュー (過去 30 日間)
perveen ali
perveen ali 2017 年 5 月 24 日
コメント済み: perveen ali 2017 年 5 月 24 日
I am using d=dir(*.001), and can see file name (abcd.001) from name=d.name but fid1=fopen(name) returns negative value.
  4 件のコメント
perveen ali
perveen ali 2017 年 5 月 24 日
@KSSV yes i have only one file in the dir
James Tursa
James Tursa 2017 年 5 月 24 日
編集済み: James Tursa 2017 年 5 月 24 日
I assume you meant to type d=dir('*.001') with the single quotes? Works for me PCWIN R2011a:
>> d=dir('*.001')
d =
name: 'abcd.001'
date: '24-May-2017 09:00:35'
bytes: 16
isdir: 0
datenum: 7.3684e+005
>> d.name
ans =
abcd.001
>> fid = fopen(d.name)
fid =
3

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2017 年 5 月 24 日
fopen replies -1, if the name is a folder.
  2 件のコメント
perveen ali
perveen ali 2017 年 5 月 24 日
i think there was some issue with folder. I copied file to the same folder where my code is and it works fine now. thanks.
perveen ali
perveen ali 2017 年 5 月 24 日
but this is not the solution for me. how can I open a subfolder and read *.001 file.

サインインしてコメントする。


Steven Lord
Steven Lord 2017 年 5 月 24 日
Call fopen with two outputs. If the first output is -1, display the second output to see why the file open operation did not succeed.

カテゴリ

Help Center および File ExchangeFiles and Folders についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by