フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to store, write and call in another program ?

1 回表示 (過去 30 日間)
Tarun
Tarun 2012 年 7 月 9 日
I would like to know, how to store a particular variable in a file ? after that, I have to call that variable in an another program, so how to do that ?
[EDITED, Jan] Copied from comment section, because information needed to define the question exactly, should be found in the question. I've removed the request for the mail address, because this does not match the nature of the forum.
In one program: I wrote down a function. Please find below a part of the program:
[n, bc] = hist(im,31); % n is the number of occurrence in each bin
% and bc are the bin centers
p = n/sum(n); % normalize occurrences to create estimate of PDF
figure(3), bar(bc, p) title('PDF estimate of 1st formants');
xlabel('standard deviation'); ylabel('no. of occurence');
bc is a 1*31 double,
I have to store bc first and call this in another .m program..
So I need to know, how to store the bc(1*31) and then call it in another .m program.
  2 件のコメント
Jan
Jan 2012 年 7 月 9 日
Please post more details. Does "another program" mean another M-function or a program like Excel?
Walter Roberson
Walter Roberson 2012 年 7 月 14 日

回答 (1 件)

Conrad
Conrad 2012 年 7 月 9 日
編集済み: Jan 2012 年 7 月 9 日
Hi Tarun, something like this:
myVariable = 1; % Assign value to variable.
save myVariable.mat myVariable; % Save to *.mat file.
In your 2nd program:
load myVariable.mat; % Load *.mat file.
Type "help save" in MATLAB for more information.
Or did you mean accessing the data in a program different from MATLAB?
Conrad
[EDITED, Jan, code formatted]
  1 件のコメント
Jan
Jan 2012 年 7 月 9 日
It is safer to specify the full path of the file, e.g. "D:\Temp\myVariable.mat", because the other function could have changed the current folder.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by