Afficher commentaires plus anciens
function plot_EM_cath(raw_EM_cath)
figure numcath = size(raw_EM_cath,2)
for i = 1:numcath plot3(raw_EM_cath(i).cath(8:end,1),raw_EM_cath(i).cath(8:end,2),raw_EM_cath(i).cath(8:end,3)) end
I'm attempting to make a simple plot that will plot a 3D line. I need it to plot all 12 needles (catheters here) but I'm not exactly sure how to iterate over each. My syntax may be off as I've never coded before. How can I fix this? Thanks!
2 commentaires
Robert Fennis
le 23 Août 2017
You might very well not have to. Can you elaborate more on what kind of data you have, in what variable name and exactly which plot function you attempt to use?
Anna-Kate Hard
le 23 Août 2017
Réponses (1)
Star Strider
le 23 Août 2017
Modifié(e) : Star Strider
le 23 Août 2017
Without your data I can’t completely troubleshoot your code.
This should get you started:
numcath = size(raw_EM_cath,2);
figure(1)
hold on
for i = 1:numcath
plot3(raw_EM_cath(i).cath(8:end,1),raw_EM_cath(i).cath(8:end,2),raw_EM_cath(i).cath(8:end,3))
end
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
view(45, 30)
EDIT —
Your ‘xyz continuous plotted.fig’ appears to be plotted correctly. I would add the grid on call and axis labels.
3 commentaires
Anna-Kate Hard
le 23 Août 2017
Jan
le 23 Août 2017
@Anna-Kate: If you provide the complete error message, the readers do not have to guess, which line is concerned.
Star Strider
le 23 Août 2017
@Anna-Kate Hard — I tested my code with a 3D matrix, since I do not have your data. My code works correctly as far as I can test it.
@Jan — Thank you!
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!