필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Green에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by