outputname of variable depending on inputname
6 ビュー (過去 30 日間)
古いコメントを表示
Hello everybody,
I wrote a function which smoothes data and I did it as general as possible, in order to that I renamed the input data to X:
function [] = Curvesmoothing(filename, curvename, range)
%% load data
X = load(filename, curvename);
X = X.(curvename);
...calculations
Xsmooth = [smoothedX]
But now I don't want to save the result with this meaningless name, but rather with its inputname and the information how many circumjacent values were used for the smoothing, i.e. curvename + "smooth" + range. And this into the origin file, because I want to be able to feed the function with data, undependent of its origin. Now is my Question how I get Matlab to rename Xsmooth into a specific name, depending on other variables.
e.g. I tried to do it by creating a structure, similiar to my approach above, but I ended up with a structure named S, which contains the array (with the right name & data), but I could not figure out how to extract this array (see below).
Q = curvename + "smooth" + range;
S.(Q) = Xsmooth;
save(filename, curvename + "smooth" + range , '-append')
I also already figured out how to specify the filename, but I don't want to create too many .mat files, in order to keep some tidiness in my data.
Best Regards
Fabian
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Preprocessing Data についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!