Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

New to Matlab- Pls help

anu914anu914 Posts: 1Member
Hi,

This is my first thread in this forum. Hope somebody will help me.

I am writing a simple Matlab program and in that I have an array of numbers with repeating numbers. I want to extract the dissimilar numbers and put in an array. I used below method to do that and it seems to work.


a=1;

for k=1:(2^n-1)

if Logpp(k)~= Logpp(k+1)
Logpp_val(a,1)=Logpp(k,1);
a=a+1;
k=k+1;

else
k=k+1;

end

end

Here I compare the numbers in the original array if they are not equal I write that to the final array.

I'd like to know whether there's an easier or rather optimized way to do this Matlab as I need to repeat this often in the program.

Thanks in advance for the help.


Comments

Sign In or Register to comment.