Plot 4d data
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi :) how can one import an excel sheet with x, y, z and V columns as a 3d matrix? I am trying to plot the V values over a co ordiante system (using slice function) .
Thanks!
0 comentarios
Respuestas (1)
Joe Vinciguerra
el 1 de Oct. de 2019
May not be the most efficient, but this is what I came up with:
Here's my sample data based on my interpretation of your description:
% Load the data from the source file
[filename, pathname] = uigetfile('*.xls*','MultiSelect','off'); % open file selection dialog
ScriptFolder = cd(pathname); % change to the folder location you selected so you can read the file
A = readmatrix(filename); % read the file you selected
% assign to seperate variables for clarity
x = A(:,1);
y = A(:,2);
z = A(:,3);
% build a multidimensional array (again, may not be the most efficient approach)
% https://www.mathworks.com/help/matlab/math/multidimensional-arrays.html
for i=1:length(A)
V(x(i),y(i),z(i)) = A(i,4);
end
% plot using the slice function
% https://www.mathworks.com/help/matlab/ref/slice.html
xslice = [1,2,3];
yslice = [];
zslice = [2];
slice(V,xslice,yslice,zslice)
0 comentarios
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!