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

Wed, 08 Nov 2017 22:23:26 +0000
Re: rounding times
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349650#956622
dpb
On 08Nov17 2:27 PM, Bruce Bowler wrote:<br>
> Any good tricks for rounding a serial date number to the nearest minute?<br>
><br>
> Obviously I could convert to a datevec, look at the seconds part, and do<br>
> some magic, but I can't believe there's not something better (for various<br>
> definitions of "better").<br>
<br>
Look at DATESHIFT() with the datetime object, the optional parameter <br>
rule,'nearest' should do what you're looking for (altho I've not ever <br>
used it other than with either the 'next' or 'previous' options<br>
<br>
dateshift(yourDateTimeArray,'start','minute','nearest')<br>
<br>
seems should work...<br>
<br>


Wed, 08 Nov 2017 20:27:47 +0000
rounding times
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349650#956621
Bruce Bowler
Any good tricks for rounding a serial date number to the nearest minute? <br>
<br>
Obviously I could convert to a datevec, look at the seconds part, and do <br>
some magic, but I can't believe there's not something better (for various <br>
definitions of "better").<br>
<br>
Thanks!<br>
Bruce

Wed, 08 Nov 2017 20:15:09 +0000
Re: linear regression for circularlinear data
https://se.mathworks.com/matlabcentral/newsreader/view_thread/135248#956620
Honi Sanders
"Honi Sanders" <honi@mit.edu> wrote in message <ott2i0$j7k$1@newscl01ah.mathworks.com>...<br>
> Try Richard Kempter's algorithm for circularlinear correlation. <br>
> described in Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R (2012) Quantifying circularlinear associations: hippocampal phase precession. J Neurosci Methods 207:113–124. <a href="http://dx.doi.org/10.1016/j.jneumeth.2012.03.007">http://dx.doi.org/10.1016/j.jneumeth.2012.03.007</a><br>
<br>
<br>
<br>
You should also look at Philipp Beren's CircStat toolbox. <br>
1. P. Berens, J. Stat. Softw. 31 (2009). <a href="http://kyb.mpg.de/fileadmin/user_upload/files/publications/attachments/JStatSoftw2009Berens_6037">http://kyb.mpg.de/fileadmin/user_upload/files/publications/attachments/JStatSoftw2009Berens_6037</a>[0].pdf<br>
<br>
In particular, I would say that if you are dealing with a circular independent variable and a linear dependent (response) variable, then you want to use circ_corrcl() from CircStat. If you are dealing with a linear independent variable and a circular dependent variable, you want to use cl_corr() from Richard Kempter's implementation.

Wed, 08 Nov 2017 16:09:15 +0000
Re: exponential function in matlab
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349649#956618
Alan Weiss
On 11/8/2017 4:10 AM, Tony Bales wrote:<br>
> any idea how to execute complex exponential functions using matlab. my project sucks...<br>
> <br>
<br>
I am not sure that I understand what you mean. MATLAB computes<br>
exp(1+1i) = 1.4687 + 2.2874i<br>
<br>
Alan Weiss<br>
MATLAB mathematical toolbox documentation

Wed, 08 Nov 2017 09:10:46 +0000
exponential function in matlab
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349649#956617
Tony Bales
any idea how to execute complex exponential functions using matlab. my project sucks...

Wed, 08 Nov 2017 00:21:01 +0000
Re: writing cell with string and numerical matrix to Excel using xlswrite?
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349645#956615
beginner1.mat@hotmail.com
On Monday, November 6, 2017 at 10:15:54 PM UTC5, beginn...@hotmail.com wrote:<br>
> I am trying to write a cell (called FORM) that is a 1x5 cell, that contains string and numerical values. Within the FORM cell it looks like:<br>
> <br>
> 'Form Name' 1x10 double 1x10 double 1x10 double 1x10 double<br>
> <br>
> I tried the following:<br>
> <br>
> xlswrite('filename.xls', FORM)%<br>
> <br>
> This did not work...I cannot write the FORM cell to Excel using xlswrite.<br>
> <br>
> I removed the string, 'Form Name' (which leaves me with a 1x4 cell of numerical values), and was able to write the numerical values to Excel using:<br>
> <br>
> xlswrite('filename.xls',FORM)% this works when I remove the first column of string data, leaving the other 4 cells showing as 1x10 double 1x10 double 1x10 double 1x10 double<br>
> <br>
> I have seen there may be ways to use fprintf, but I would rather simply use xlswrite, if possible. <br>
> <br>
> Please help!<br>
<br>
Very clear explanation and it worked! Thank you!

Tue, 07 Nov 2017 19:46:08 +0000
Re: linear regression for circularlinear data
https://se.mathworks.com/matlabcentral/newsreader/view_thread/135248#956613
Honi Sanders
Try Richard Kempter's algorithm for circularlinear correlation. <br>
described in Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R (2012) Quantifying circularlinear associations: hippocampal phase precession. J Neurosci Methods 207:113–124. <a href="http://dx.doi.org/10.1016/j.jneumeth.2012.03.007">http://dx.doi.org/10.1016/j.jneumeth.2012.03.007</a>

Tue, 07 Nov 2017 16:12:57 +0000
Re: How to do 2D KarhunenLoeve(KL) transform in matlab?
https://se.mathworks.com/matlabcentral/newsreader/view_thread/268287#956612
prathyushamanuvarthi@gmail.com
On Sunday, December 13, 2009 at 12:30:06 AM UTC+5:30, chang wrote:<br>
> Hi everyone, <br>
> do you guys know how to do 2 dimensional KL transform? I know how to do a 1D one. But I really have no idea about how 2D transform works. And I have google a lot and find nothing on 2D case... <br>
Please send the KL Transform for 2D image having more pixel value.<br>
> Thanks in advance!<br>
> <br>
> Michael

Tue, 07 Nov 2017 14:02:14 +0000
Re: writing cell with string and numerical matrix to Excel using
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349645#956611
dpb
On 06Nov17 9:15 PM, beginner1.mat@hotmail.com wrote:<br>
> I am trying to write a cell (called FORM) that is a 1x5 cell, that contains string and numerical values. Within the FORM cell it looks like:<br>
><br>
> 'Form Name' 1x10 double 1x10 double 1x10 double 1x10 double<br>
><br>
> I tried the following:<br>
><br>
> xlswrite('filename.xls', FORM)%<br>
><br>
> This did not work...I cannot write the FORM cell to Excel using xlswrite.<br>
><br>
> I removed the string, 'Form Name' (which leaves me with a 1x4 cell<br>
> of numerical values), and was able to write the numerical values to Excel <br>
using:<br>
><br>
> xlswrite('filename.xls',FORM)% this works when I remove the first<br>
> column of string data, leaving the other 4 cells showing as 1x10<br>
> double1x10 double 1x10 double 1x10 double<br>
><br>
> I have seen there may be ways to use fprintf, but I would rather<br>
> simply use xlswrite, if possible.<br>
<br>
<br>
help xlswrite<br>
<br>
xlswrite(filename,A)example<br>
...<br>
A — Data to write<br>
matrix  cell array<br>
Data to write, specified as a twodimensional numeric or character <br>
array, or, if each cell contains a single element, a cell array.<br>
...<br>
<br>
Reconfigure your A storage pattern as<br>
<br>
A=[A{1} num2cell(A{2}) num2cell(A{3})]<br>
<br>
and you can use XLSWRITE() per the documentation. Or, use the <br>
Sheet,Range optional arguments to place the cell content where needed <br>
and write the string and the numeric data separately.<br>
<br>
FRPRINT() will let you write a csv or other delimited text file but it <br>
will not write a native .xls file in Excel.<br>
<br>


Tue, 07 Nov 2017 12:23:19 +0000
Confidence Interval
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349646#956610
Javier Bernal Pampín
I have just read an article tittled “Bootstrap Methods for Bias Correction and Confidence Interval Estimation for Nonlinear Quantile Regression of Longitudinal Data”. I want to analyze my data with weight i using PBD for percentile method CIp. I need to calculate confidence Interval 95 and 99 % using this bootstrap method together with their bias. I Will do that with series of data range of 4 values each one. I have installed Matlab R2017a software but I am not able to write the proper syntax. I would like to ask you if you could tell me the correct way to do it.

Tue, 07 Nov 2017 03:15:49 +0000
writing cell with string and numerical matrix to Excel using xlswrite?
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349645#956609
beginner1.mat@hotmail.com
I am trying to write a cell (called FORM) that is a 1x5 cell, that contains string and numerical values. Within the FORM cell it looks like:<br>
<br>
'Form Name' 1x10 double 1x10 double 1x10 double 1x10 double<br>
<br>
I tried the following:<br>
<br>
xlswrite('filename.xls', FORM)%<br>
<br>
This did not work...I cannot write the FORM cell to Excel using xlswrite.<br>
<br>
I removed the string, 'Form Name' (which leaves me with a 1x4 cell of numerical values), and was able to write the numerical values to Excel using:<br>
<br>
xlswrite('filename.xls',FORM)% this works when I remove the first column of string data, leaving the other 4 cells showing as 1x10 double 1x10 double 1x10 double 1x10 double<br>
<br>
I have seen there may be ways to use fprintf, but I would rather simply use xlswrite, if possible. <br>
<br>
Please help!

Mon, 06 Nov 2017 17:36:09 +0000
Re: Speed of new graphics engine
https://se.mathworks.com/matlabcentral/newsreader/view_thread/337755#956606
Igor Matlab
Hi Yair,<br>
<br>
I had tried the things you suggested, but I didn't realize that the following statement in my startup.m file overruled those commands:<br>
<br>
set(0, 'DefaultFigureRenderer', 'painters')<br>
<br>
That statement was there from the "zbuffer" days but removing that statement gave more or less normal performance.<br>
<br>
I recall that painters rendering was always superior to opengl rendering and inferior to zbuffer rendering, maybe this has changed now?<br>
<br>
Best Regards,<br>
Igor<br>
<br>
<br>
<br>
<br>
"Yair Altman" wrote in message <otpu2c$f99$1@newscl01ah.mathworks.com>...<br>
> "Igor Matlab" <igor.devries@sbmoffshore.com> wrote in message <otpedo$c1a$1@newscl01ah.mathworks.com>...<br>
> > I went from 2012a to 2017a, and now it takes approximately 1600x longer for a surf command to execute....<br>
> [snip]<br>
> <br>
> About the only thing that has a chance of improving things for you is to ensure that you have the latest graphics driver (download & install if necessary) and that your Matlab recognizes it  run opengl('info') to ensure that Software=false (i.e., using hardware acceleration)  if it is true then you're running on OpenGL's slow software emulation, so try to force it to use the hardware accelerator using opengl('hardware').<br>
> <br>
> Note that even then, it will still be [much] slower than in your R2012a, but hopefully not by a factor of 1600x but rather by a much more acceptable factor.<br>
> <br>
> If it's still not acceptable, you would need to modify your code (for example, plot far fewer data points).<br>
> <br>
> Yair Altman <br>
> <a href="http://UndocumentedMatlab.com">http://UndocumentedMatlab.com</a> <br>
> Author: "Accelerating MATLAB Performance" (CRC Press, 2014)<br>
>

Mon, 06 Nov 2017 15:11:08 +0000
Re: Speed of new graphics engine
https://se.mathworks.com/matlabcentral/newsreader/view_thread/337755#956605
Yair Altman
"Igor Matlab" <igor.devries@sbmoffshore.com> wrote in message <otpedo$c1a$1@newscl01ah.mathworks.com>...<br>
> I went from 2012a to 2017a, and now it takes approximately 1600x longer for a surf command to execute....<br>
[snip]<br>
<br>
About the only thing that has a chance of improving things for you is to ensure that you have the latest graphics driver (download & install if necessary) and that your Matlab recognizes it  run opengl('info') to ensure that Software=false (i.e., using hardware acceleration)  if it is true then you're running on OpenGL's slow software emulation, so try to force it to use the hardware accelerator using opengl('hardware').<br>
<br>
Note that even then, it will still be [much] slower than in your R2012a, but hopefully not by a factor of 1600x but rather by a much more acceptable factor.<br>
<br>
If it's still not acceptable, you would need to modify your code (for example, plot far fewer data points).<br>
<br>
Yair Altman <br>
<a href="http://UndocumentedMatlab.com">http://UndocumentedMatlab.com</a> <br>
Author: "Accelerating MATLAB Performance" (CRC Press, 2014)<br>

Mon, 06 Nov 2017 13:11:08 +0000
Re: penalty function code
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349637#956604
Karan Gill
"Ma Dely Esberto" wrote in message <otmpin$c67$1@newscl01ah.mathworks.com>...<br>
> I was doing this optimization using interior penalty function code with the objective function<br>
> f=(1/3).*(x1+1).^3+x2. the 1st barrier is g1(x1,x2)=(1x1), and the second is: g2(x1,x2)=x2.<br>
> after running the code, the screen displayed: <br>
> step r x1 x2 f(r)<br>
>     <br>
> 0 0.10 Error using fprintf<br>
> Unable to convert 'sym' value to 'double'.<br>
> <br>
<SNIP><br>
<br>
The error message tells you the function where the error occurred. Here the function is "fprintf". The error says you cannot convert "sym" to "double". This means you have provide the "fprintf" function wtih symbolic values (sym) but "fprintf" needs "doubles". So you need to provide "fprintf" with an input it understands.<br>
<br>
Convert "double" to "sym" by using the "double" function. See: https://www.mathworks.com/help/symbolic/double.html<br>
Then refer to the "fprintf" help page for examples: https://www.mathworks.com/help/matlab/ref/fprintf.html

Mon, 06 Nov 2017 11:51:08 +0000
get 3D pixels belonging to a cut plan
https://se.mathworks.com/matlabcentral/newsreader/view_thread/349642#956603
Anass
Hi all,<br>
<br>
I'm trying to get (coordinates) and count the 3D pixels belonging to a cut plane of a 3D cylindrical form (it's not a real cylinder. It's a brunch of a bifurcation). For this, I'm using the rule which stays that the equation of a cut plane perpendicular to a point A(xA,yA,zA) (belonging to the cylinder) can be defined if we have a normal vector vec(AB)(xAB,yAB,zAB) with B a 3D pixel belonging to the cylinder and a point M(xM,yM,zM) (point belonging to the 3D stack) such as: vec(AB).dot(vec(AM))=0. Hence M is belonging to the cut plane. <br>
Is this the good approach ? I don't succeed to find 3D pixels that verify the equation of the cut plane stated as: <br>
xAB*(xM  xA) + yAB*(yMyA) + zAB*(zMzA)=0