Effacer les filtres
Effacer les filtres

How to use fprintf in the following situation?

2 vues (au cours des 30 derniers jours)
Taner Cokyasar
Taner Cokyasar le 9 Juil 2016
Hello,
I have following vectors tmvalues and Zimfi. I am finding Yvalues vector by using those two and finding the following answer.
tmvalues - Zimfi = Yvalues
12 0 12
11 0 11
10 6 4
12 0 12
11 3 8
10 0 10
12 0 12
11 5 6
10 0 10
Then, to print Yvalues with its title, I am using the following code (i=m=3) and having the following output:
[Y1,Y2] = meshgrid(1:i,1:m);
Ytitle = [Y1(:),Y2(:),Yvalues(:)];
fprintf(' Y%d%d %d\n',Ytitle.')
Y11 12
Y12 11
Y13 4
Y21 12
Y22 8
Y23 10
Y31 12
Y32 6
Y33 10
However, I don't want to print the rows of Yvalues answer, where Zimfi element is 0. So, I actually want to have this result.
Y13 4
Y22 8
Y32 6
How can I eliminate the rows of Yvalues which of its Zimfi element is 0? Sorry for writing so long. I wanted to make it as clear as possible. I really appreciate for your answers.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 9 Juil 2016
M=[ 12 0 12
11 0 11
10 6 4
12 0 12
11 3 8
10 0 10
12 0 12
11 5 6
10 0 10]
[Y1,Y2] = meshgrid(1:3,1:3);
Ytitle = [Y1(:),Y2(:),M(:,3)]
Ytitle=Ytitle(M(:,2)~=0,:)
fprintf(' Y%d%d %d\n',Ytitle.')

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by