How can I save specific range of my data?

4 ビュー (過去 30 日間)
Bob
Bob 2016 年 7 月 24 日
コメント済み: Star Strider 2016 年 7 月 24 日
I have two variables as output from a simulink model, A and B.
A has 500001 rows and 1 column (5000001x1 double)
B has 500001 rows and 1 column (5000001x1 double)
I want a code which saves my data as .mat
save('AB.mat','A','B'); % save('FileName','Variables');
but only the half values of A and B respectivly.
For example,
A = [ 250001 250002 250003 ... 500001];
B = [ 250001 250002 250003 ... 500001];

採用された回答

Star Strider
Star Strider 2016 年 7 月 24 日
You would have to define new variables, for example ‘Ahalf’ and ‘Bhalf’:
Ahalf = A(fix(size(A,1)/2):end);
Bhalf = A(fix(size(B,1)/2):end);
save('ABhalf.mat','Ahalf','Bhalf'); % save('FileName','Variables');
NOTE — This is UNTESTED CODE. However it should work.
  2 件のコメント
Bob
Bob 2016 年 7 月 24 日
Thanks, work like a charm!
Star Strider
Star Strider 2016 年 7 月 24 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by