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

Wed, 29 Mar 2017 10:37:04 +0000
Parfor Generating Different Results
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348006#952751
Alex Charles
Hello, <br>
<br>
I have been using parfor to run a function for lots of different scenarios simultaneously to speed up results. However, I have noticed that the results being outputted are slightly wrong, they appear as if Matlab has been too slow to realise that a process has ended. <br>
<br>
Each iteration of the function is independent of the last. The code works as expected when run just as a for loop.<br>
<br>
% Varaibles<br>
liveDataSelc % Large matrix (global)<br>
sdate % (global single variable)<br>
runlen % (global single variable)<br>
UFCost(s), newCap(s), maxPower(s) % Values in arrays<br>
parfor s = 1:samples % Loop to find results for all batteries<br>
<br>
[cumSavyear,Year(s),Saving(s),pbtime(s),SavingPY(s,:),DoDmean(s),disTmean(s),cycle(s)] = dlivsgforfunc(liveDataSelc,sdate,UFCost(s), newCap(s), maxPower(s),runlen)<br>
totsaving(s)= cumSavyear(1,size(cumSavyear,2));% Create total savings from cumlative savings array<br>
<br>
end<br>
<br>
I would like to know what is causing this issue and if there is any simple way I can work around it? <br>
<br>
Thanks in advance

Wed, 29 Mar 2017 10:22:06 +0000
How to repeat a signal in Signal builder block
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348005#952750
Praveen Kumar Kuppusamy
I added a new pulse in Signal builder block. But unable to find a way to repeat it for sequence of example 10 pulses etc. Could anyone help me ?<br>
Thanks

Wed, 29 Mar 2017 10:15:58 +0000
Re: mex doesn't recognize available compilers in my PC
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347998#952749
mecej4
On 3/28/2017 5:51 PM, Juan Diego Pico wrote:<br>
> So I've been trying to run a couple of mex files from<br>
> https://www.mathworks.com/matlabcentral/fileexchange/36019lithiumbatterymodelsimscapelanguageandsimulinkdesignoptimization<br>
><br>
> but when I try to set my mex it doesn't recognize any of the solvers<br>
> that I have, that is accounting for MS Visual C++ from 2008 to 2013, or<br>
> the SDK 7.1 on a matlab 2015a version.<br>
> < CUT ><br>
><br>
> Do you have any pointers as to what is happening?<br>
<br>
Yes, this shortcoming of the Mex setup has been with us for many years.<br>
<br>
What I generally do is to build the Mex (which is just a DLL with a <br>
changed file suffix) in a VCconfigured command window. That way, I have <br>
precise control over how the DLL is compiled, what compiler options to <br>
specify, whether the MEX is 32bit or 64bit, which external libraries <br>
to link with, and which code symbols are to be exported from the DLL.<br>
<br>
With this approach, you will have the ability to use any compiler, <br>
including GCC or MASM if you wish, as long as your code matches the <br>
Matlab ABI/API.<br>
<br>
 mecej4<br>
<br>
mecej_four@nospam.invalid<br>
(Replace four by 4, nospam by operamail, invalid by com,<br>
and remove all underscores)

Wed, 29 Mar 2017 09:52:03 +0000
label2rgb
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348004#952748
Poulami Ganguly
Hi I have a bw image that I have labeled using bwlabel(). Each of the connected components has a unique label but when I try to convert the labels to rgb colors by using label2rgb the colors assigned to some of the different components (even when they don't touch each other) is the same.<br>
<br>
Should I define a colormap to avoid this issue or is there another way to specify this in label2rgb?<br>
<br>
Thanks!

Wed, 29 Mar 2017 08:55:04 +0000
filetr design from estimated trasnfer function
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348003#952747
Michal Kvasnicka
Is there any way how to design filter (a,b coeffs) from transfer function estimated by "tfestimate"?

Wed, 29 Mar 2017 08:00:03 +0000
Re: fprintf with unicode
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347975#952746
Bruno Luong
"Yair Altman" wrote in message <br>
> Perhaps this will help:<br>
> feature('DefaultCharacterSet', 'UTF8')<br>
> <br>
> See <a href="http://UndocumentedMatlab.com/blog/coupleofmatlabbugsandworkarounds#comment340931">http://UndocumentedMatlab.com/blog/coupleofmatlabbugsandworkarounds#comment340931</a> as well as the other comments on that page.<br>
> <br>
<br>
It won't help.<br>
<br>
The issue I encounered seem to be not mentioned by the blog. The string seem to be handled correctly by the editor, since I can copy and past and the unicode character is correctly transfered to other software.<br>
<br>
The issue seem to be when inside MATLAB string, the MATLAB parser behaves differently whereas it is on script/function or on command line window.<br>
<br>
The later handle correctly, whereas the character in the string is corrupted when it is parsed within script/fucnction.<br>
<br>
PS: I can post the test function directly here for illustration, since the newsreader cannot handle the unicode characters.

Wed, 29 Mar 2017 07:17:03 +0000
Re: Connecting MATLAB to MySQL DB without using driver(ODBC/JDBC)
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347987#952745
Lakshmi Gandhi
"MAHA" wrote in message <obd468$jtv$1@newscl01ah.mathworks.com>...<br>
> Hi,<br>
> How to connect to MySQL DB without using ODBC/JDBC driver or SQLlite DB ?<br>
> <br>
> Our MATLAB programmer has written a program logic that it reads some data from DB, process it and writes back to DB. She used ODBC driver and used the DSN to connect with Database<br>
> Lets say this logic resides in "ImpExp.m" file. This file she compiled as an application and saved as "ImpExp.exe" <br>
> <br>
> This executable when shipped to end user, it says "Invalid connection" Since there is a dependency for DSN. NOTE: The end user has MATLAB runtime installed<br>
> <br>
> 1. Though creating a ODBC connection in the end user machine(same DSN as used in "ImpExp.m") could solve this issue, is there anyway to handle this? Like any built in function available in MATLAB to connect to Database without using DSN?<br>
> <br>
> 2. How do end user knows to create DSN in the same name as used in the source code?<br>
> <br>
> 3. If the "ImpExp.exe" is planned to deploy in our own Windows server, Is installing ODBC driver advisable in the server?<br>
> <br>
> Thanks

Wed, 29 Mar 2017 07:10:03 +0000
NaN as String
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348002#952744
Abhishek Venk
Hi , I amtrying to write a Matrix with csvwirte where I Need the first cell to be a empty cell . For this I used a Syntax like<br>
<br>
H=[2:0.2:4]<br>
V=[3:0.2:5]<br>
Z=[10*H]<br>
M=[NaN,H]<br>
M2=[V',Z]<br>
M3=[M;M2]<br>
<br>
Now when i write the M3 as Csv i have NaN in the first cell . I Need it either empty where by NaN is not displayed or even better wilöl be if I can attach a string to the NaN cell and Display it. like for example . Instead of NaN , 'v/h' or something like that .. I have gone through mulötiple Forums but I couldnt find a working solution . Any help regardingthe same will be really appreciated.<br>
<br>
Thanks.<br>
Abhi

Wed, 29 Mar 2017 05:30:03 +0000
Re: Matlab Toolbox for Singular Spectrum Analysis
https://de.mathworks.com/matlabcentral/newsreader/view_thread/53242#952743
Geesara Prathap
Now there is an official package is available for SSA which is available under Chaotic Systems Toolbox. https://in.mathworks.com/matlabcentral/fileexchange/1597chaoticsystemstoolbox?s_tid=srchtitle <br>
<br>
And here is a sample you can start with: https://in.mathworks.com/matlabcentral/fileexchange/58967singularspectrumanalysisbeginnersguide?s_tid=srchtitle<br>
<br>
<br>
<br>
<br>
"Nicholas Beser" wrote in message <bj4n2t$5ff$1@houston.jhuapl.edu>...<br>
> I have been asked to teach a matlab class covering Singular Spectrum<br>
> Analysis. While I have been able to find research toolboxes that perform the<br>
> time series analysis, I have not been able to identify a Mathworks product<br>
> that directly supports SSA. Is this correct?<br>
> <br>
> Thankyou,<br>
> <br>
> Nick Beser<br>
> JHU/APL<br>
> <br>
> <br>
>

Wed, 29 Mar 2017 04:41:03 +0000
Problem using GUI
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348001#952742
Janee Alam
<br>
Error in BrainMRI_GUI>pushbutton1_Callback (line 97)<br>
axes(handles.axes1)<br>
<br>
Error in gui_mainfcn (line 95)<br>
feval(varargin{:});<br>
<br>
Error in BrainMRI_GUI (line 46)<br>
gui_mainfcn(gui_State, varargin{:});<br>
<br>
Error in<br>
@(hObject,eventdata)BrainMRI_GUI('pushbutton1_Callback',hObject,eventdata,guidata(hObject))<br>
<br>
<br>
Error while evaluating uicontrol Callback

Wed, 29 Mar 2017 02:43:02 +0000
Re: Text and variable in one line
https://de.mathworks.com/matlabcentral/newsreader/view_thread/247350#952741
dpb
On 03/28/2017 4:45 PM, Nasser M. Abbasi wrote:<br>
...<br>
<br>
> better I think to use sprintf. More standard and can<br>
> have more control on formating.<br>
><br>
>>> x=pi; sprintf('The value of x is %f\n',x)<br>
><br>
><br>
> The value of x is 3.141593<br>
<br>
"Anything you can do, I can do, too!"<br>
Sincerely,<br>
NUM2STR()<br>
<br>
>> num2str(pi,'The value of x is %f')<br>
ans =<br>
The value of x is 3.141593<br>
>><br>
<br>
:)<br>
<br>
The advantage is NUM2STR automatically builds arrays that SPRINTF() can't...<br>
<br>
>> x=[1:3].'*pi;<br>
>> num2str(x,'The value of x is %f')<br>
ans =<br>
The value of x is 3.141593<br>
The value of x is 6.283185<br>
The value of x is 9.424778<br>
>> whos ans<br>
Name Size Bytes Class Attributes<br>
ans 3x26 156 char<br>
<br>
>> sprintf('The value of x is %f\n',x)<br>
ans =<br>
The value of x is 3.141593<br>
The value of x is 6.283185<br>
The value of x is 9.424778<br>
<br>
>> whos ans<br>
Name Size Bytes Class Attributes<br>
ans 1x81 162 char<br>
<br>
>><br>
<br>
While the second case superficially _looks_ the same on the screen, <br>
that's only because of the embedded \n; it's still just one long string <br>
in actuality.<br>
<br>
OTOH, the NUM2STR() result is a 3xN character array so the three <br>
elements can be addressed individually. This is specifically of much <br>
use in writing values for ticks or specific graphs or legends or <br>
labeling bars in histograms, etc., etc., etc., where the vectorized <br>
return is invaluable.<br>
<br>
For a single string it really makes no difference; as you say SPRINTF() <br>
serves just as well but there's a reason NUM2STR() exists.<br>
<br>


Wed, 29 Mar 2017 02:13:03 +0000
Vectorizatize custom function in nested for loops
https://de.mathworks.com/matlabcentral/newsreader/view_thread/348000#952740
Wasim Aftab
Hi, I've a symmetric matrix M with more than 4000 dimension. I'm computing weighted cross correlation(wcc) for each pair of rows as follows:<br>
for i=1:rows<br>
for j=1:rows<br>
W(i,j)=wcc(M(i,:), M(j,:), 1);<br>
end<br>
end<br>
<br>
Where wcc() is a custom function. Is it possible to make the nested function calls fully vectorized?<br>
<br>
Thanks and Best Regards,<br>
Wasim

Wed, 29 Mar 2017 02:04:03 +0000
Re: 2 equal functions, different outputs
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347989#952739
Craig Smith
"Bruno Luong" wrote in message <obdm23$47$1@newscl01ah.mathworks.com>...<br>
> Sorry, typo correction<br>
> <br>
> % Ratio should be 1<br>
> fprintf('%1.15e\n', exp(2*x) ./ (exp(x)).^2)<br>
> <br>
> % Error<br>
> fprintf('%1.15e\n', 1exp(2*x) ./ (exp(x<br>
<br>
Awesome :) Thanks Bruno

Wed, 29 Mar 2017 00:28:03 +0000
Procrustes Analysis
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347999#952738
Joe Putos
I am looking for help...literally...on how to quantify the shape of intervertebral lumbar discs segmented from MRI images. Quantifying the shape of the discs to see if there are any changes in shape using Procrustes Analysis is the objective.

Tue, 28 Mar 2017 23:30:08 +0000
Re: Find index zero and nonzero elements in an array
https://de.mathworks.com/matlabcentral/newsreader/view_thread/347992#952737
James Tursa
"Jéssica Soares" wrote in message <obdr1f$ba1$1@newscl01ah.mathworks.com>...<br>
> Hello fellows,<br>
> <br>
> I have to find the indexes of zero AND nonzero elements in a matrix. I tried to use the function find() but the coordinates of zero elements does not show up. I also used ind2sub() but it can just be used correctly for linear elements.<br>
> <br>
> Does anyone knows a solution?<br>
> <br>
> Thanks!<br>
<br>
Please show code for what you are currently doing and why it is not giving you the results you want or need. E.g.,<br>
<br>
>> x = rand(1,10)<br>
x =<br>
Columns 1 through 8<br>
0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157<br>
Columns 9 through 10<br>
0.7922 0.9595<br>
>> x(x<.5) = 0<br>
x =<br>
Columns 1 through 8<br>
0 0.9706 0.9572 0 0.8003 0 0 0.9157<br>
Columns 9 through 10<br>
0.7922 0.9595<br>
>> find(x==0)<br>
ans =<br>
1 4 6 7<br>
>> find(x~=0)<br>
ans =<br>
2 3 5 8 9 10<br>
<br>
So, finding the indexes above works for this small example. What is it that you are doing that is not working for you?<br>
<br>
James Tursa