Error normalising multiple data sets with the same parameters

I've compiled 5 different datasets into a 3D plot by loading the relevant plots using the method below:
openfig('3DPlot1.fig');
Plot1 = get(gca,'Children');
Plot1_X = get(Plot1, 'ZData');
Plot1_Y = get(Plot1, 'ZData');
Plot1_Z = get(Plot1, 'ZData');
but now need to normalise the temperature (Z axes) axes for all datasets obtained this way.
I've tried using the following method from the normalize() page:
[N,C,S] = normalize(___) additionally returns the centering and scaling values C and S used to perform the normalization. Then, you can normalize different input data using the values in C and S with N = normalize(A2,'center',C,'scale',S).
So it looks like this in my code:
[Plot1_T, C, S] = normalize(Plot1_Z);
Plot2_T = normalize(Plot2_Z, 'center', C, 'scale', S);
But I'm getting the error "Error using normalize. Too many output arguments.". Could this be something to do with the way I'm loading the data as I don't see any error with typing in the code? If so, how else could I normalise all the data? I can't normalise them separately as it will affect the 3D plot shapes once all datasets are shown.
Thank you!

 採用された回答

Voss
Voss 2022 年 3 月 23 日

1 投票

Assuming you already have gotten the ZData of each object whose ZData you want to normalize "globally", you can do this to normalize them all on a common basis (based on the min and max over all ZData):
% you have done this already:
Plot1_Z = get(Plot1, 'ZData');
Plot2_Z = get(Plot2, 'ZData');
Plot3_Z = get(Plot3, 'ZData');
Plot4_Z = get(Plot4, 'ZData');
Plot5_Z = get(Plot5, 'ZData');
% put the ZData all together in a column vector:
all_Z = [Plot1_Z(:); Plot2_Z(:); Plot3_Z(:); Plot4_Z(:); Plot5_Z(:)];
% get the min and max values:
min_Z = min(all_Z);
max_Z = max(all_Z);
% normalize each to [0,1] using min_Z and max_Z:
Plot1_Z = (Plot1_Z-min_Z)/(max_Z-min_Z);
Plot2_Z = (Plot2_Z-min_Z)/(max_Z-min_Z);
Plot3_Z = (Plot3_Z-min_Z)/(max_Z-min_Z);
Plot4_Z = (Plot4_Z-min_Z)/(max_Z-min_Z);
Plot5_Z = (Plot5_Z-min_Z)/(max_Z-min_Z);
% update the plots with the normalized ZData:
set(Plot1, 'ZData', Plot1_Z);
set(Plot2, 'ZData', Plot2_Z);
set(Plot3, 'ZData', Plot3_Z);
set(Plot4, 'ZData', Plot4_Z);
set(Plot5, 'ZData', Plot5_Z);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAxes Appearance についてさらに検索

タグ

質問済み:

2022 年 3 月 23 日

回答済み:

2022 年 3 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by