필터 지우기
필터 지우기

2 M file interaction

조회 수: 10 (최근 30일)
amira hl
amira hl 2015년 6월 2일
편집: Walter Roberson 2015년 6월 18일
Hi i'm using Matlab 2009 , i have my code in 1 M file , and the results of that code, should be used in other M file, how can i do that?
  댓글 수: 3
amira hl
amira hl 2015년 6월 2일
편집: Walter Roberson 2015년 6월 18일
i mean in one M file i have this
clc; clear all; close all;
im=imread('cameraman.tif');
whos im
f=im(3,3)
b=1;
delta=20;
wi=1;
%insertion
m=floor(f/((2^b)*delta));
r=f-(2^b)*m*delta;
f1=(2^b)*m*delta+wi*delta+r/(2^b)
im(3,3)=f1;
in the next M file i should use the value of im(3,3), delta and b already calculated
%extraction
m1=floor(f1/delta);
r1=f1-m1*delta;
wi=m1-(2^b)*floor(m1/(2^b))
f=(2^b)*floor(m1/(2^b))*delta+(2^b)*r1
Amine
Amine 2015년 6월 2일
You can also write an m-file where you call another m-file, example: Im_calculation % which is your first m-file %Then you continue your code below. And do not forget to save the two m-files in the same path. Good chance!

댓글을 달려면 로그인하십시오.

채택된 답변

B.k Sumedha
B.k Sumedha 2015년 6월 2일
function f1=im()
im=imread('cameraman.tif');
f=im(3,3);
b=1;
delta=20;
wi=1;
%insertion
m=floor(f/((2^b)*delta));
r=f-(2^b)*m*delta;
f1=(2^b)*m*delta+wi*delta+r/(2^b);
im(3,3)=f1;
Thats ur first part.
b=1;
delta=20;
wi=1;
m1=floor(im()/delta);
r1=im()-m1*delta;
wi=m1-(2^b)*floor(m1/(2^b));
f=(2^b)*floor(m1/(2^b))*delta+(2^b)*r1;
This is ur second part where im() is being used.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by