フィルターのクリア

call variables via evalin command into function

5 ビュー (過去 30 日間)
fatema saba
fatema saba 2014 年 6 月 25 日
コメント済み: fatema saba 2014 年 6 月 25 日
Hello I want to call some variable via 'evalin' into function. then I created z1 and z2 in workspace and save them into 'myfile8.mat'. then I created my function and named it 'ave1'. This is my function:
function[f]= ave1(z1,z2)
evalin('base','myfile8.mat');
load myfile8.mat
[n1,n2]=size(z1);
n3=n1*n2
[n4,n5]=size(z2);
n6=n4*n5
B=reshape(z1,n3,1);
C=reshape(z2,n6,1);
f=[B(:);C(:)]
end
when I ran 'ave1' in workspace I got this error:
Undefined variable "myfile8" or class "myfile8.mat".
Error in ==> ave1 at 2
evalin('base','myfile8.mat');
What is my problem and How can I solve it? Thanks
  4 件のコメント
José-Luis
José-Luis 2014 年 6 月 25 日
My comment is still valid, I think. You could pass them all in a structure for instance.
fatema saba
fatema saba 2014 年 6 月 25 日
Ok, How can I change my function please?

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by