IF I rename a variable name with eval after how I can save the variable with the new name?

2 ビュー (過去 30 日間)
Flavia Aluisi
Flavia Aluisi 2018 年 4 月 3 日
コメント済み: Guillaume 2018 年 4 月 3 日
Hi, I have a problem to save a value with the name create by using "eval" function. Here the code
ZscoreUnitResponses(path,cellType,stage,event)
eventfile=fullfile(path,cellType);
y = getfield(stage, event);
first_part = y(:,[1:950]);
second_part = y(:,[951:1900]);
b = size(first_part,2);
z = [];
for i = 1:b
a = first_part(:,i);
Z_first = zscore(a);
c = second_part(:,i);
Z_second = zscore(c);
z = [Z_first Z_second];
end
filename = event;
e = inputname(3);
e = strtok(e ,'psth_');
cell = char(cellType);
name = [e filename];
str = [name,'= z;'];
eval(str);
end
can you please help me to solve this problem?
  6 件のコメント
Flavia Aluisi
Flavia Aluisi 2018 年 4 月 3 日
my last goal is to save the "z" value with the name given by eval
Guillaume
Guillaume 2018 年 4 月 3 日
No, that is not your ultimate goal. You're then planning to do something with that. What is it?
save the "z" value is a bit meaningless. Save to disk? in a mat file?

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by