how to combine two .m files into one file

15 ビュー (過去 30 日間)
sandeep k
sandeep k 2016 年 6 月 18 日
コメント済み: Fawad Chandio 2019 年 9 月 23 日
i want to use the data of two m-files to plot joint histogram
  1 件のコメント
Guillaume
Guillaume 2016 年 7 月 7 日
Do you really mean .m file which is just source code of a script,function or class, or .mat file which is used for storing the content of variables?
What is the data of an .m file? The text content of the file? The output(s) of the script or function in the file?

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

回答 (2 件)

MOHIT
MOHIT 2016 年 6 月 18 日
clear the question, what kind of file?

Bojun Ma
Bojun Ma 2016 年 7 月 7 日
編集済み: Stephen23 2016 年 7 月 7 日
packagemFiles({'file1','file2','file3'});
function packagemFiles(FileNames)
N=length(FileNames);
if N<1
return;
else
TragetFile = ['Combined_',FileNames{1}];
[hTargetFile,ErrMsg] = fopen(TragetFile,'w');
end
for i=1:N
[hSourceFile,ErrMsg] = fopen(FileNames{i},'r');
if hSourceFile < 0
disp([varargin{i},'is not found!']);
fclose(hSourceFile);
return;
end
Data = fread(hSourceFile);
fclose(hSourceFile);
fwrite(hTargetFile,Data);
end
fclose(hTargetFile);
end
  1 件のコメント
Fawad Chandio
Fawad Chandio 2019 年 9 月 23 日
where we put this code behends button or where...??

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by