필터 지우기
필터 지우기

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?

답변 (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