How to run a generated plot function after editing a plot?

3 ビュー (過去 30 日間)
Muazma Ali
Muazma Ali 2022 年 8 月 12 日
コメント済み: Karim 2022 年 8 月 13 日
Hi! :)
When I run the function colorcode_surf_plotting, I make three variables x, y, z. Then I do some changes to my plot and save the file by generating the code.
When I so try to run the generated code after I have saved the file , then I just send three inputs, x, y, z as I thought were required to run the function I generated after I edited my plot. But it seems it is not enough.. why? I get this error message:
'index exceeds the nr of array elements'
  1 件のコメント
Karim
Karim 2022 年 8 月 13 日
when i try to run the code, see below, no error is shown... when do you obtain the error?
osmotisk_data = readtable("https://nl.mathworks.com/matlabcentral/answers/uploaded_files/1096510/tester_tabeller.xlsx");
x = osmotisk_data{:,1};
y = osmotisk_data{:,2};
z = osmotisk_data{:,3};
numPoints = size(z, 1);
% Make a colormap with, say, 256 potential colors .
numColors = 256 ;
cmap = jet(numColors);
% Get the rows of the colormap that each value of z should take on .
colorIndex = round(rescale(z, 1, numColors ));
for k = 1 : numPoints
thisColor = cmap(colorIndex(k ), :);
plot3(x(k), y(k), z(k),'.', 'Color', thisColor, 'MarkerSize', 40 )
hold on ;
end
colormap(cmap );
colorbar
fontSize = 12 ;
xlabel('Osmotisk trykk', 'FontSize',fontSize );
ylabel('Sone nummer', 'FontSize',fontSize );
zlabel('Samlet aktivitet', 'FontSize',fontSize );
grid on

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by