http://www.mathworks.com/matlabcentral/newsreader/most_recent_feed
MATLAB Central Newsreader Recent Posts
Most Recent Posts
enus
©19942017 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Thu, 30 Mar 2017 21:15:10 +0000
Re: while loop is not working properly
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348022#952788
dpb
On 03/30/2017 3:47 PM, samia saghir wrote:<br>
> fprintf( 'Below are some Tasks:\nTask1\nTask2\nTask3\nTask4\nTask5\n')<br>
> NumberOfTask= input('\n How many task/s you want:' , 's');<br>
...<br>
<br>
NumberOfTask is character variable, not numeric. Either kill the 's' <br>
optional argument or<br>
<br>
<br>
NumberOfTask=str2num(NumberOfTask);<br>
<br>


Thu, 30 Mar 2017 20:47:04 +0000
while loop is not working properly
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348022#952787
samia saghir
hey!<br>
I'm trying to write a program which gets input from user about how many tasks he/she wants to perform and then run the Task selection statement exactly the same number of times. below is my code.<br>
clc<br>
fprintf( 'Below are some Tasks:\nTask1\nTask2\nTask3\nTask4\nTask5\n')<br>
NumberOfTask= input('\n How many task/s you want:' , 's');<br>
NumberOfTask<br>
fprintf('')<br>
count=0;<br>
while (count <= NumberOfTask);<br>
Task = input('\nSelect a Task: ', 's');<br>
fprintf('\n\n')<br>
switch Task<br>
case 'Task1'<br>
fprintf('Proposed Time:10 \n Proposed Benifite:30\n Location:18\n')<br>
count = count+1;<br>
case 'Task2'<br>
fprintf('Proposed Time:20 \n Proposed Benifite:100\n Location:03\n')<br>
count = count+1;<br>
case 'Task3'<br>
fprintf('Proposed Time:05 \n Proposed Benifite:250\n Location:54\n')<br>
count = count+1;<br>
case 'Task4'<br>
fprintf('Proposed Time:10 \n Proposed Benifite:50\n Location:65\n')<br>
count = count+1;<br>
case 'Task5'<br>
fprintf('Proposed Time: 40\n Proposed Benifite:500\n Location:19\n')<br>
count = count+1;<br>
otherwise<br>
fprintf('Error, no such Task is found! Try again!\n')<br>
<br>
%count = count + 1;<br>
<br>
end<br>
fprintf('\n\n')<br>
end<br>
<br>
<br>
But it is not working , it runs unlimited times and does not takes into account the condition. i have tried to use if else condition but that will only runs the program once, i need a loop here , kindly tell me what is wrong with my logic and help me correct the code please someone help me

Thu, 30 Mar 2017 20:37:03 +0000
Re: Assign two variables in the same cell
http://www.mathworks.com/matlabcentral/newsreader/view_thread/341747#952786
Caleb Nehls
"Vijay Reddy" wrote in message <mnlqaj$ghr$1@newscl01ah.mathworks.com>...<br>
> I am working on Cellular Automata. I want to assign two variables in same cell (like concentration value and grain number). How should I proceed.<br>
<br>
Did you figure this out? I am currently working on CA and I know what I want to do but not how I want to do it. Did you develop any .m files that I could use as a reference?

Thu, 30 Mar 2017 18:25:03 +0000
Re: Data cursor for Axes in Guide
http://www.mathworks.com/matlabcentral/newsreader/view_thread/235125#952785
Pedro Busc
menuCallback is empty for me! Why?

Thu, 30 Mar 2017 17:35:03 +0000
Re: How to make a msgbox without 'ok' button
http://www.mathworks.com/matlabcentral/newsreader/view_thread/117288#952784
Pedro Busc
"Nathan Orloff" wrote in message <kmgi49$lci$1@newscl01ah.mathworks.com>...<br>
> h = msgbox('This could be a minute. Patience, grasshopper...','Importing Images','help');<br>
> child = get(h,'Children');<br>
> delete(child(3))<br>
<br>
The correct is child(1).<br>
Full function:<br>
<br>
function h = MessageBox(message,title,messageType,hideOk)<br>
% Show message box<br>
% Source: https://www.mathworks.com/matlabcentral/newsreader/view_thread/117288<br>
<br>
if ~exist('messageType','var')<br>
messageType = 'help';<br>
end<br>
<br>
if ~exist('hideOk','var')<br>
hideOk = 1;<br>
end<br>
<br>
h = msgbox(message,title,messageType);<br>
child = get(h,'Children');<br>
<br>
if hideOk<br>
delete(child(1)); % Removes ok button<br>
drawnow;<br>
end<br>
<br>
end

Thu, 30 Mar 2017 13:29:03 +0000
Re: Basic question about FFT and PSD
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285433#952782
nazmul islam
Dear Wayne,<br>
I have got a few questions, regarding the answer (which was very well documented) you have given here.<br>
<br>
Q1. Did you mean Nyquist Frequency lies on N/2 = 512th sample ?<br>
if so, then<br>
Q2.<br>
It was mentioned in Case 2: For onesided PSD The zero frequency estimate (DC) and the Nyquist frequency estimates are NOT multiplied by 2. Therefore,<br>
Y_fft=y_fft(1:513);<br>
Y_fft(2:end1)=2*Y_fft(2:end1)<br>
<br>
So, i wonder if 512th sample was still multiplied by 2, as you are omitting sample no. 1 & 513.<br>
(Yes, i understand that 'psd_est_1side' is ( 1x513) vector i.e., psd_est_1side=psd(h,y,'spectrumtype','onesided','Fs',10000);)<br>
<br>
Also, i wonder if works only for N=n*1024, n=interger ; since we wont get any length of (N/2+1) for 'psd_est_1side' vector if N = between 1024 & 2048, or the like.<br>
<br>
Q.3<br>
I wonder if it is possible see/use the amplitude(or magnitude) values as it was possible for frequencies (i.e. psd_est_1side.Frequencies.).<br>
if yes, how? (I failed to see through 'psd_est_1side.amplitudes')<br>
<br>
I would highly appreciate your time to be spent on this matter.<br>
<br>
Regards<br>
Nazmul

Thu, 30 Mar 2017 08:06:03 +0000
Directivity of Dodecahedron Loudspeaker
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348020#952781
ICHA ADY RISTANTI
Hi, good afternoon.<br>
Firstly, I'd like to introduce myself, Icha as undergraduate students.<br>
In this forum, i want to asking about directivity of Dodecahedron loudspeaker.<br>
I have a data or polar pattern of one driver loudspeaker, and I want to get a directivity of dodecahedron loudspeaker with Matlab Simulation.<br>
Anyone can help me? Maybe, give me a script or explain how to simulate it.<br>
Thank you very much.

Thu, 30 Mar 2017 07:45:03 +0000
Reference to a cleared variable
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348019#952780
vincent mbuvi
Reference to a cleared variable Pout.<br>
<br>
Error in HW_2_Problem_2_b_i_m (line 56)<br>
plot (Pout(:,1),Pout(:,2))<br>
<br>
<br>
Am getting the above error massage when I try to plot a graph through a simulink model. <br>
Am initiating the model though an mfile from where the "plot (Pout(:,1),Pout(:,2))" code line 56 is located.<br>
In simulink Pout is a scope and when I double click on it am able to view the transient graph generated. The simulink model sims to load correctly. This error is preventing a graph from being generated through the workspace. <br>
<br>
The commands "clear all", "close all" and "clc" are not the problem as I have other programs with the same output running without error and generating the plot.<br>
<br>
Thanks

Thu, 30 Mar 2017 07:41:03 +0000
Re: Fast Removal of Array values
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348016#952779
Bruno Luong
It is not recommend to grow or skrink arrays especially within a loop since it is always costly and there is no faster way.<br>
<br>
In your case what you need is reorganize your code and use some kind of circular buffer to keep last p/q data.<br>
<br>
Bruno

Thu, 30 Mar 2017 06:39:01 +0000
Re: need help
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348018#952778
Nasser M. Abbasi
On 3/30/2017 1:26 AM, nir margalit wrote:<br>
> in need to create a 97 length vector with randomly 1:8 numbers<br>
> for example:<br>
> 1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
><br>
> THANKS<br>
><br>
<br>
<br>
one possibility might be<br>
<br>
randi(8,1,97)<br>
<br>
doc randi for more info<br>
<br>
Nasser

Thu, 30 Mar 2017 06:26:04 +0000
need help
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348018#952777
nir margalit
in need to create a 97 length vector with randomly 1:8 numbers <br>
for example:<br>
1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
<br>
THANKS

Thu, 30 Mar 2017 06:24:03 +0000
need help
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348017#952776
nir margalit
in need to create a 97 length vector with randomly 1:8 numbers <br>
for example:<br>
1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
<br>
THANKS

Thu, 30 Mar 2017 06:07:03 +0000
Fast Removal of Array values
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348016#952775
George Hulme
I currently have a loop in a program that calculates the x y and z values for the lorenz attractor, using the euler method, that I have made for a coursework (I cannot use the built in rungakutta based function already in matlab). I have done a profiler report on the program and the loop in the program, specifically the data removal section, takes a very large large amount of time to complete.<br>
<br>
The loop is given below:<br>
j = 1;<br>
for i=1:N<br>
X(j+1) = X(j) + (s*(X(j) + Y(j)))*H;<br>
Y(j+1) = Y(j) + (r*X(j)  Y(j)  X(j)*Z(j))*H;<br>
Z(j+1) = Z(j) + (b*Z(j) + X(j)*Y(j))*H;<br>
<br>
% Cuts out extra data that would otherwise fill memory and slow the<br>
% program significantly at low H values<br>
if mod(i,q) == 0<br>
pop = jq+1:j1;<br>
X(pop) = [];<br>
Y(pop) = [];<br>
Z(pop) = [];<br>
j = j  q + 1;<br>
end<br>
j = j + 1;<br>
end<br>
<br>
My question is: What is the fastest way to remove array elements from a 1xN array where N is an integer greater than 10000000?<br>
<br>
Any help would be greatly appreciated

Thu, 30 Mar 2017 05:57:36 +0000
Re: Shadow Removal Using Entropy minimization
http://www.mathworks.com/matlabcentral/newsreader/view_thread/262429#952774
bce.anil@gmail.com
On Friday, August 19, 2016 at 7:13:08 PM UTC+5:30, Han Gong wrote:<br>
> See my code here: https://uk.mathworks.com/matlabcentral/fileexchange/52233grahamfinlaysonsilluminationinvariantimage<br>
> <br>
> I believe this is the best implementation. I work with the lead author of the paper.<br>
> <br>
> Cheers,<br>
> Han<br>
> "Sandeep " <sandeepdevasrii@gmail.com> wrote in message <hafchq$bl1$1@fred.mathworks.com>...<br>
> > <br>
> > Hi all,<br>
> > <br>
> > I am trying to implement a shadow removal algorithm in matlab. I follow the paper<br>
> > written by Mr.Graham.Finalyson i.e, "Shadow removal using Entropy minimization".<br>
> > First of all i am trying to get 1D illuminant invariant image by assuming that we<br>
> > know the projection angle. I took some known images from the above mentioned<br>
> > paper so that i know the projection angle and there is no need of entropy calculation.<br>
> > The program which wrote works with some images and seems to be failed with some images. Please help me if some one has some experience with this algorithm. I am appending small part of my matlab code which is written to produce a 1D illumination invariant image.<br>
> > <br>
> > <br>
> > I = imread('file1.tiff');<br>
> > J = im2double(I);<br>
> > <br>
> > R = J(:,:,1);<br>
> > G = J(:,:,2);<br>
> > B = J(:,:,3);<br>
> > <br>
> > [len,wid] = size(R);<br>
> > <br>
> > % Generation of 2D Log Chromaticity Image.<br>
> > for i = 1:len<br>
> > for j = 1:wid<br>
> > if ((R(i,j)*G(i,j)*B(i,j))~= 0)<br>
> > c1(i,j) = R(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > c2(i,j) = G(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > c3(i,j) = B(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > else<br>
> > c1(i,j) = 1;<br>
> > c2(i,j) = 1;<br>
> > c3(i,j) = 1;<br>
> > end<br>
> > end<br>
> > end<br>
> > <br>
> > rho1 = mat2gray(log(c1));<br>
> > rho2 = mat2gray(log(c2));<br>
> > rho3 = mat2gray(log(c3));<br>
> > <br>
> > X1 = mat2gray(rho1*1/(sqrt(2))  rho2*1/(sqrt(2))); %(1/sqrt(2); 1/sqrt(2); 0)<br>
> > X2 = mat2gray(rho1*1/(sqrt(6)) + rho2*1/(sqrt(6))  rho3*2/(sqrt(6))); %(1/sqrt(6); 1/sqrt(6); 2/sqrt(6))<br>
> > <br>
> > theta = 120;<br>
> > <br>
> > InvariantImage = cos(theta*pi/180)*X1 + sin(theta*pi/180)*X2;<br>
> > <br>
> > <br>
> > <br>
> > Thank you all,<br>
> > Sandeep P<br>
<br>
can u provide matlab code for video shadow removal my email id is bce.anil@gmail.com

Thu, 30 Mar 2017 05:31:03 +0000
How to remove lead vocal without losing the bass
http://www.mathworks.com/matlabcentral/newsreader/view_thread/348015#952773
Steven Aldo
Hi, recently I'm working on lead vocal elimination for my thesis.<br>
I tend to do it as simple as it can be done.<br>
Based on this link (https://www.quora.com/AudioEditingWhatisthebestwaytoremovevocalfromasoundtrackusingMATLAB), I have try to code:<br>
<br>
>> [y,fs]=wavread('sekaini2.wav');<br>
>> left=y(:,1);<br>
>> right=y(:,2);<br>
>> wavplay(0.6*(left+(right*1)),fs);<br>
<br>
and the result is, the lead vocal has gone and leave the back vocal, as I hoped to. But using that method, the bass track has also dissapear, which I don't expect to.<br>
What I want is, eliminate the lead vocal while keep the bass remaining in the output.<br>
<br>
Can anyone correct me or give me some suggestions how to do it better? Since I'm new to Matlab.<br>
<br>
Thanks in advance.