https://fr.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
https://fr.mathworks.com/images/membrane_icon.gif

Wed, 23 Aug 2017 22:03:09 +0000
classification learner app  feature selection
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349410#956035
Alex A
Hello,<br>
<br>
I am using the Classification Learner App to train a model with less features than imported (using feature selection to unselect some of them). I imported 15 features but I only left 10 selected. However, after exporting the model to workspace and executing:<br>
<br>
trainedModel.HowToPredict<br>
<br>
it requires me to use as many features as the original set: <br>
"yfit = c.predictFcn(X) <br>
<br>
X must contain exactly 15 columns because this model was trained using 15 predictors."<br>
<br>
Why is that?<br>
<br>
Thank you.

Wed, 23 Aug 2017 21:45:08 +0000
Re: Low level graphic issue
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349358#956034
Leo
"Bruno Luong" wrote in message <on8uf8$l3h$1@newscl01ah.mathworks.com>...<br>
> To the best of my knowledge such Java error comes up now and then and exists forever and TMW never fix it. You might try to increase Java Heap Size memory in Preference > General menu.<br>
<br>
<br>
Well I just did (max) and the error persist<br>
I guess will have to uninstall and install and older version of matlab

Wed, 23 Aug 2017 21:12:07 +0000
Reset the Color Order Property of an axis
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/258032#956033
Adrianne
The 'ColorOrderIndex' Axes Property is now exposed to handle this. You can reset the color order between plots, or set the next line to an arbitrary color. <br>
<br>
Between plot commands, try: <br>
<br>
set(gca,'ColorOrderIndex',1);

Wed, 23 Aug 2017 20:23:10 +0000
Re: How to xlsread a file without the empty rows being deleted
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349388#956031
Steven Lord
"Ali Ajouz" <aliajouz@gmail.com> wrote in message <onjpo9$8ie$1@newscl01ah.mathworks.com>...<br>
> Same problem. Any advice? <br>
<br>
If you're using release R2016b or later consider using import options with the READTABLE function. For example I have a simple spreadsheet (named sampleExcelWorkbook.xlsx) with headers column1, column2, and column3. Column1 is completely empty, column2 has some empty cells and some cells with numbers, and column3 has a few empty cells but most cells contain numbers. I can use the detectImportOptions function to control how the data is imported into the table.<br>
<br>
>> opt = detectImportOptions('sampleExcelWorkbook.xlsx')<br>
>> T = readtable('sampleExcelWorkbook.xlsx', opt)<br>
<br>
Since I didn't have anything in column1, it defaulted to importing the data as char. Let's change that to import as double.<br>
<br>
>> opt.VariableTypes{1} = 'double';<br>
>> T2 = readtable('sampleExcelWorkbook.xlsx', opt)<br>
<br>
Note that in T2 the data in column1 is NaN, indicating that the data was missing. If you wanted to read the data in using some other value to fill in missing elements, change the VariableOptions in opt using SETVAROPTS.<br>
<br>
 <br>
Steve Lord<br>
slord@mathworks.com<br>
To contact Technical Support, use the Contact Us link at the top of <a href="http://www.mathworks.com">http://www.mathworks.com</a>

Wed, 23 Aug 2017 18:54:09 +0000
Problem Running a Matlab Exacutable in the Command Line
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349408#956030
Layne
When running my matlab executable in the command line (filename.exe), the command window clears, runs the script, shows me all of the standard command window outputs but does not return to the command line "C:\somepath>" without having to click enter.<br>
<br>
This ends up causing me problems when I'm trying to run multiple scripts in powershell.<br>
Any suggestions?

Wed, 23 Aug 2017 18:25:14 +0000
Manually Correcting false border detection
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349407#956029
Jessica Mitzi
Hi all, <br>
<br>
I am trying to create a code that automatically analyzes the border of an abject from a series of photographs. I have used thresholding of each color channel and eventually bwboundaries and burning the border mask unto the original image to see how accurate it is. As you can predict, given a series of similar photograph with slightly different shading and colors, not all border detection is 100% accurate. Is there any way to let the user manually correct the border detection, by some sort of dragging commands? I know that bwboundaries stores the coordinates of each point, and I have been looking at impoly and imfreehand to manually create draggable freehand region on the image, but is there any way to integrate those two things together, i.e. manually dragging a set of existing points/curve?<br>
<br>
Any help would be appreciated. <br>
<br>
Best, <br>
<br>
Jessica

Wed, 23 Aug 2017 16:24:10 +0000
Re: How to xlsread a file without the empty rows being deleted
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349388#956028
Felix
Bruce Bowler <bbowler@bigelow.org> wrote in message <f05hj7FsuefU1@mid.individual.net>...<br>
> On Wed, 23 Aug 2017 10:34:09 +0000, Felix wrote:<br>
> <br>
> > Bruce Bowler <bbowler@bigelow.org> wrote in message<br>
> > <f03hmfFf45kU1@mid.individual.net>...<br>
> >> On Tue, 22 Aug 2017 18:04:08 +0000, Felix wrote:<br>
> >> <br>
> >> > hi,<br>
> >> > <br>
> >> > I am trying to read an excel file that has 31 columns. some columns<br>
> >> > have no data but each column has a heading.<br>
> >> > <br>
> >> > e.g<br>
> >> > <br>
> >> > A1 A2 A3<br>
> >> > 4<br>
> >> > 5<br>
> >> > when I read the file it automatically deletes any column that does<br>
> >> > not fall between any two columns with values in their rows. This<br>
> >> > keeps changing the number of columns every time I try to read the<br>
> >> > file.<br>
> >> > <br>
> >> > How can I read the file while maintaining the empty cells?<br>
> >> > <br>
> >> > I used [Weight, txt, raw]=xlsread('Results','Weight');% import Weight<br>
> >> > file<br>
> >> > <br>
> >> > This is not working<br>
> >> <br>
> >> The cell array "raw" has the data in an "unmolested" form.<br>
> > <br>
> > Yes I have that but the data Weight that's a double is always missing<br>
> > the empty rows<br>
> <br>
> Yes, but the data you seek is the "raw" variable. It may be a cell array, <br>
> but there are ways to deal with it as a cell array.<br>
> <br>
> xlsread is working exactly as documented.<br>
> <br>
> What value do you want in the "missing" data? ("weight" is an array so, <br>
> by definition, there MUST be a value there).<br>
> <br>
> Your options are to figure out how to use "raw" (it's not hard) or to <br>
> "fix" the spreadsheet so that there are some value in the "empty" cells.<br>
<br>
Thanks for your response.<br>
<br>
The problem is that I don't know how to use the raw data in my code but I guess that's the way out. So far, I was able to get around it with my old way by inserting any random value into the first row of any empty column. This way the matrix dimensions stayed the same and I don't have to enter a lot of values.<br>
<br>
I will try to find my way around the raw outputs.<br>
<br>
Thanks again.

Wed, 23 Aug 2017 15:14:21 +0000
Re: save a new line without overwrite mat file
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349406#956027
angelo
Hi,<br>
<br>
did you try with the append?<br>
save(filename,variables,'append') adds new variables to an existing file, and does not overwrite it.<br>
<br>
Bye<br>
<br>
angelo

Wed, 23 Aug 2017 14:41:06 +0000
Re: Random numbers
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349397#956026
Nicola Sacco
"Torsten" wrote in message <onk1su$piu$1@newscl01ah.mathworks.com>...<br>
> "Nicola Sacco" wrote in message <onk0ca$mcm$1@newscl01ah.mathworks.com>...<br>
> > "Torsten" wrote in message <onjn07$2to$1@newscl01ah.mathworks.com>...<br>
> > > "Nicola Sacco" wrote in message <onjir5$nd3$1@newscl01ah.mathworks.com>...<br>
> > > > <br>
> > > > Hello,<br>
> > > > I have a gaussian distribution with zero mean and standard deviation 1.<br>
> > > > If I use function STD to calculate standard deviation I get a result that is not 1.<br>
> > > > Where am I wrong?<br>
> > > > Here is the code:<br>
> > > > <br>
> > > > x = [3:.1:3];<br>
> > > > norm_x = normpdf(x, 0, 1);<br>
> > > > sigma = std(norm_x)<br>
> > > > <br>
> > > > <br>
> > > > Thanx<br>
> > > <br>
> > > If you generate random numbers taken from a normal distribution with zero mean and standard deviation one (using MATLAB's "randn", e.g.) and you calculate the standard deviation of these random numbers, you should approximately arrive at a value of 1. <br>
> > > <br>
> > > This has absolutely nothing to do with what you do above.<br>
> > > <br>
> > > Best wishes<br>
> > > Torsten. <br>
> > <br>
> > Thank you for the answer.<br>
> > Well I need to work with pdf.<br>
> > Other suggestions?<br>
> <br>
> sqrt(integral(@(x)x.^2.*normpdf(x,0,1),Inf,Inf))<br>
> <br>
> gives you the standard deviation of a normal distribution with zero mean and standard deviation one, thus 1.<br>
> <br>
> Does that help ?<br>
> <br>
> Best wishes<br>
> Torsten.<br>
<br>
This is very useful. Thank You!

Wed, 23 Aug 2017 14:25:44 +0000
Re: How to xlsread a file without the empty rows being deleted
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349388#956025
Bruce Bowler
On Wed, 23 Aug 2017 10:34:09 +0000, Felix wrote:<br>
<br>
> Bruce Bowler <bbowler@bigelow.org> wrote in message<br>
> <f03hmfFf45kU1@mid.individual.net>...<br>
>> On Tue, 22 Aug 2017 18:04:08 +0000, Felix wrote:<br>
>> <br>
>> > hi,<br>
>> > <br>
>> > I am trying to read an excel file that has 31 columns. some columns<br>
>> > have no data but each column has a heading.<br>
>> > <br>
>> > e.g<br>
>> > <br>
>> > A1 A2 A3<br>
>> > 4<br>
>> > 5<br>
>> > when I read the file it automatically deletes any column that does<br>
>> > not fall between any two columns with values in their rows. This<br>
>> > keeps changing the number of columns every time I try to read the<br>
>> > file.<br>
>> > <br>
>> > How can I read the file while maintaining the empty cells?<br>
>> > <br>
>> > I used [Weight, txt, raw]=xlsread('Results','Weight');% import Weight<br>
>> > file<br>
>> > <br>
>> > This is not working<br>
>> <br>
>> The cell array "raw" has the data in an "unmolested" form.<br>
> <br>
> Yes I have that but the data Weight that's a double is always missing<br>
> the empty rows<br>
<br>
Yes, but the data you seek is the "raw" variable. It may be a cell array, <br>
but there are ways to deal with it as a cell array.<br>
<br>
xlsread is working exactly as documented.<br>
<br>
What value do you want in the "missing" data? ("weight" is an array so, <br>
by definition, there MUST be a value there).<br>
<br>
Your options are to figure out how to use "raw" (it's not hard) or to <br>
"fix" the spreadsheet so that there are some value in the "empty" cells.

Wed, 23 Aug 2017 14:13:08 +0000
Re: Boxplot error when running anova1
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/331954#956024
Tyler Benster
"Robert" wrote in message <lahaqr$48o$1@newscl01ah.mathworks.com>...<br>
> "Fred" wrote in message <l2tslq$e74$1@newscl01ah.mathworks.com>...<br>
> > Hello, <br>
> > <br>
> > I wanted to try anova1 function and started looking at the example which is shown in Help (Example 1). Just copied and pasted everything into the command window (so what is shown below comes directly from the Matlabs help)<br>
> > <br>
> > X = meshgrid(1:5);<br>
> > X = X + normrnd(0,1,5,5);<br>
> > p=anova1(X);<br>
> > <br>
> > Error using boxplot<br>
> > Too many input arguments.<br>
> > <br>
> > Error in anova1 (line 268)<br>
> > boxplot(ax,xorig,'notch','on');<br>
> > <br>
> > I get the window with the results from the ANOVA but it seems to bug somewhere when trying to plot the boxplot. <br>
> > <br>
> > Has someone already encountered this problem?<br>
> > <br>
> > I'm running version R2012b 8.0.0.783 on Mac. <br>
> > <br>
> > <br>
> > Thanks for your help<br>
> > <br>
> > <br>
> > Fred<br>
> <br>
> Hi Fred,<br>
> <br>
> I can't help much, but the error is reproducible on my Mac running MATLAB 8.2.0.701 (R2013b + Statistics Toolbox Version 8.3):<br>
> x = [1,2,3,4,5]; group = [1,1,2,2,2]; boxplot(x,group);<br>
> produces a plot with one group (not the two that are defined, so boxplot.m<br>
> already looks like it has a bug in it) and then<br>
> anova1(x,group)<br>
> produces your error message.<br>
> <br>
> Maybe someone at Mathworks will acknowledge / fix the bug in boxplot.<br>
> <br>
> Rob<br>
<br>
I'm still encountering this bug as of R2017a.

Wed, 23 Aug 2017 14:02:06 +0000
Re: Random numbers
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349397#956023
Torsten
"Nicola Sacco" wrote in message <onk0ca$mcm$1@newscl01ah.mathworks.com>...<br>
> "Torsten" wrote in message <onjn07$2to$1@newscl01ah.mathworks.com>...<br>
> > "Nicola Sacco" wrote in message <onjir5$nd3$1@newscl01ah.mathworks.com>...<br>
> > > <br>
> > > Hello,<br>
> > > I have a gaussian distribution with zero mean and standard deviation 1.<br>
> > > If I use function STD to calculate standard deviation I get a result that is not 1.<br>
> > > Where am I wrong?<br>
> > > Here is the code:<br>
> > > <br>
> > > x = [3:.1:3];<br>
> > > norm_x = normpdf(x, 0, 1);<br>
> > > sigma = std(norm_x)<br>
> > > <br>
> > > <br>
> > > Thanx<br>
> > <br>
> > If you generate random numbers taken from a normal distribution with zero mean and standard deviation one (using MATLAB's "randn", e.g.) and you calculate the standard deviation of these random numbers, you should approximately arrive at a value of 1. <br>
> > <br>
> > This has absolutely nothing to do with what you do above.<br>
> > <br>
> > Best wishes<br>
> > Torsten. <br>
> <br>
> Thank you for the answer.<br>
> Well I need to work with pdf.<br>
> Other suggestions?<br>
<br>
sqrt(integral(@(x)x.^2.*normpdf(x,0,1),Inf,Inf))<br>
<br>
gives you the standard deviation of a normal distribution with zero mean and standard deviation one, thus 1.<br>
<br>
Does that help ?<br>
<br>
Best wishes<br>
Torsten.

Wed, 23 Aug 2017 13:36:10 +0000
Re: Random numbers
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349397#956022
Nicola Sacco
"Torsten" wrote in message <onjn07$2to$1@newscl01ah.mathworks.com>...<br>
> "Nicola Sacco" wrote in message <onjir5$nd3$1@newscl01ah.mathworks.com>...<br>
> > <br>
> > Hello,<br>
> > I have a gaussian distribution with zero mean and standard deviation 1.<br>
> > If I use function STD to calculate standard deviation I get a result that is not 1.<br>
> > Where am I wrong?<br>
> > Here is the code:<br>
> > <br>
> > x = [3:.1:3];<br>
> > norm_x = normpdf(x, 0, 1);<br>
> > sigma = std(norm_x)<br>
> > <br>
> > <br>
> > Thanx<br>
> <br>
> If you generate random numbers taken from a normal distribution with zero mean and standard deviation one (using MATLAB's "randn", e.g.) and you calculate the standard deviation of these random numbers, you should approximately arrive at a value of 1. <br>
> <br>
> This has absolutely nothing to do with what you do above.<br>
> <br>
> Best wishes<br>
> Torsten. <br>
<br>
Thank you for the answer.<br>
Well I need to work with pdf.<br>
Other suggestions?

Wed, 23 Aug 2017 13:26:08 +0000
what is aviread cdata property.
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349404#956020
Rufzkie
Hi since we are using matlab 2016a i cannot verify whats the output of .cdata in aviread().<br>
<br>
Im currently using VideoReader and translating the .cdata from aviread to VideoReader.<br>
<br>
Can someone explain to me whats the output of the code:<br>
<br>
avi = aviread('somevideo.avi');<br>
frames = ave.cdata;<br>
<br>
<br>
TIA.

Wed, 23 Aug 2017 13:10:12 +0000
Re: lsqnonlin nonlinear phaseless matrix equation
https://fr.mathworks.com/matlabcentral/newsreader/view_thread/349403#956019
Torsten
"mohammad bod" wrote in message <onjtns$gs0$1@newscl01ah.mathworks.com>...<br>
> Dear friends <br>
> <br>
> I want to use "lsqnonlin" for solving nonlinear phaseless matrix equation<br>
> the matrix equation is defined as follows:<br>
> <br>
> A1.X=b1<br>
> A2.X=b2<br>
> <br>
> And the nonlinear cost function which should be minimized is define as follows <br>
> <br>
> Fc= C1(X)+C2(X)<br>
> where <br>
> C1(X)= A1.X^2 b1^2 /  b1  ^2<br>
> C2(X)= A2.X^2 b2^2 /  b2  ^2<br>
> <br>
> I want to use lsqnonlin for minimization, however, I have a problem here.<br>
> lsqnonlin is to minimize a norm of a vector but here I have a sum of two norms <br>
> <br>
> dose any body have an idea about how to minimize this cost function with lsqnonlin ?<br>
> <br>
> Your helps are highly appericated.<br>
<br>
Work with<br>
<br>
A=[A1;A2]<br>
b=[b1;b2]<br>
<br>
The you should get only one norm expression.<br>
<br>
Best wishes<br>
Torsten.