フィルターのクリア

Help understanding the following errors

2 ビュー (過去 30 日間)
u-will-neva-no
u-will-neva-no 2012 年 7 月 2 日
Hello everyone, My current code is the following:
chooseEquation = 'poggiolini';
for att_db=0.18/1e3:0.01/1e3:0.20/1e3
dirname =sprintf('C:/Documents and Settings/JAY/My Documents/MATLAB/simplifyCode/data %d',att_db);
mkdir(dirname);
[ResultsPogQPSK1] = MaxReachAnalytical(chooseEquation ,att_db);
fname= sprintf('%s/ result.dat',dirname);
save(fname,'ResultsPogQPSK1');
end
mydata = load(fname);
figure(1);
plot(mydata.ResultsPogQPSK1.reach*1e-3, -8:0.1:3, '-.b', 'LineWidth', 2); hold on; grid on;
I am getting two errors that I do not understand. They are:
??? Error using ==> load
Number of columns on line 1 of ASCII file C:/Documents and
Settings/JAY/My Documents/MATLAB/simplifyCode/data 2.000000e-004/
result.dat
must be the same as previous lines.
Error in ==> PlotAnalysisCurves at 13
mydata = load(fname);
Could someone kindly explain what I am doing wrong? Thank you very much!

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 2 日
You are save()'ing files to .dat filenames but you are not specifying the -ascii option, so MATLAB is saving them as binary MAT files that happen to have funny names. MATLAB does not save() as text unless you use -ascii specifically, but MATLAB does not load() as binary unless the filename ends in .mat or you specify the -mat option specifically when you load()
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 7 月 2 日
save with -ascii, or name the files as .mat, or load with -mat
u-will-neva-no
u-will-neva-no 2012 年 7 月 4 日
Thanks Walter, that did the job!

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

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 7 月 2 日
Well I would guess the first line of the ASCII file does not have the same number of columns as the rest of the lines...
  2 件のコメント
u-will-neva-no
u-will-neva-no 2012 年 7 月 2 日
Hi Sean, im only working with .mat files and so I am not sure what exactly the ASCII file refers too. Do you know how to fix this error?
Sean de Wolski
Sean de Wolski 2012 年 7 月 2 日
It looks like a *.dat file

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by