Using matfile objects as input parameters

I was wondering if a matfile object can be used as an input parameter for any matlab function, like in the following example:
distances = matfile(output_file,'Writable',true);
distances.D = zeros(1,N*(N-1)/2);
%Compute distances and store them in distances.D
% Applying multidimensional scaling to the distances matrix
[Y,eigvals] = cmdscale(D);
Is that possible? What about operators like distances.D*distances.D? Or should I reimplement matlab functions and operators again if I am using this kind of objects?

 採用された回答

per isakson
per isakson 2013 年 7 月 12 日
編集済み: per isakson 2013 年 7 月 12 日

1 投票

Yes, it is ok to pass around matfile objects, matObj; make some simple experiments.
I don't think the documentation says anything about several different matObj, which refer to the same file at the same time.

2 件のコメント

Pablo
Pablo 2013 年 7 月 14 日
Thank you for your answer.
What if the invoked method (like cmdscale in my example) has to return a huge array? Let's suppose that there is not enough space in memory for that returned array. Is it any way to make it use matfile objects?
per isakson
per isakson 2013 年 7 月 14 日
Speculation: There should be "no difference" between
distances.D = zeros(1,N*(N-1)/2);
and
[ matObj.Y, eigvals ] = cmdscale(D);
Make an experiment to find out how smart matfile is with large variables.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by