How to run a generated plot function after editing a plot?
1 view (last 30 days)
Show older comments
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 Comment
Karim
on 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
Answers (0)
See Also
Categories
Find more on Orange in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!