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

1 Ansicht (letzte 30 Tage)
Muazma Ali
Muazma Ali am 12 Aug. 2022
Kommentiert: Karim am 13 Aug. 2022
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 Kommentar
Karim
Karim am 13 Aug. 2022
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Orange finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by