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

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Green 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by