フィルターのクリア

MatLab datenum truncated in matrix

1 回表示 (過去 30 日間)
Rhys
Rhys 2012 年 6 月 14 日
I am writing a code for a research project in space physics and at the very end I output a matrix with time, and the magnetic field strength.
The final function is
function [time, data_out]=time_Bpar_Bperp(fname)
% Function recieves a file name and out puts time, a vector in the
% direction parallel to the magentic field and a vector perpindicular to
% the magnetic field
[time, Bparallel] = loadthemismag(fname);
eparallel = make_eparallel(fname);
eperp = make_eperp(time, eparallel(:,2:4), fname);
Bperp = make_Bperp(eparallel(:,2:4), eperp, Bparallel(:,2:4));
cd('I:/olddrive')
Bparallel=findmagnitude(Bparallel(:,1:3));
Bperp=findmagnitude(Bperp);
data_out=[time, Bparallel, Bperp];
The data in time is about every 3 seconds but the data located in data_out(:,1) is not the same as time. When I plot time vs data_out(:,1), the resulting plot looks like stairs. Any ideas on why the time is being messed up in the matrix, and nothing is happening to it outside of it. If it matters the matrix is 28526 by 3.
Thanks,
Rhysics

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 14 日
Please confirm that time, Bparallel, and Bperp are all column vectors, and the class() of all of them is 'double'. If one of them happened to be an integer data type then putting them together in a matrix could result in them all being converted to integer.
  1 件のコメント
Rhys
Rhys 2012 年 6 月 15 日
Yep that's it. Thanks a lot. I should have seen that.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by