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

Mon, 26 Jun 2017 01:29:28 +0000
Re: Openfig('*.fig','reuse') opens wrong figure
https://au.mathworks.com/matlabcentral/newsreader/view_thread/167240#954826
Loren Shure
"edoardo lauri" wrote in message <br>
news:oij0qo$hqr$1@newscl01ah.mathworks.com...<br>
<br>
I have exactly the same problem with Matlab 2014.<br>
<br>
If i do openfig(file1,'reuse') and then openfig(file2,'reuse') , I get only <br>
file1 opened.<br>
<br>
does anybody know how to solve the problem?<br>
<br>
thanks<br>
<br>
<br>
<br>
<br>
"Bobane" wrote in message <fti8l9$por$1@fred.mathworks.com>...<br>
> Hi,<br>
> I am having a problem using the 'openfig' function.I have a<br>
> number of GUI windows in an application. I occasionally need<br>
> to keep several GUIs open, but only want one instance of<br>
> each GUI open. So I use openfig('gui1.fig','reuse'). However<br>
> if another GUI with a different name is already open, this<br>
> command sometimes brings up the already open GUI window and<br>
> not the specified 'gui1.fig'. It is as if openfig() is<br>
> confusing the names of the *.fig files. I have opened<br>
> 'openfig.m' and looked at it, and it seems to be flipping<br>
> the filenames (fliplr) and performing some operation on<br>
> this. But even so, I don't understand how two very different<br>
> *.fig filenames can be interchanged. Unless there is<br>
> something else happening?. Thanks for any suggestions.<br>
><br>
> Bobane.<br>
<br>
Look at the help for openfig: <br>
https://www.mathworks.com/help/matlab/ref/openfig.html<br>
<br>
remove the 2nd input argument from your calls to openfig and I think you'll <br>
get what you wanted.<br>
<br>
Loren<br>
<br>
<a href="http://blogs.mathworks.com/loren">http://blogs.mathworks.com/loren</a>

Mon, 26 Jun 2017 01:22:27 +0000
Re: Column Splitter
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348874#954825
Loren Shure
"Santiago Varas (ME)" wrote in message <br>
news:oij0qr$hrc$1@newscl01ah.mathworks.com...<br>
<br>
Hello,<br>
I have a very long (half million data points) column vector measuring engine <br>
RPMs at 1Hz. Every time the engine turns on, telemetry is recorded and <br>
stored. I need to write a script that will split this column into separate <br>
smaller columns for every time the engine is turned on, so I can data mine <br>
each separate engine run. Any idea how to go about this? I'm very new to <br>
Matlab.<br>
<br>
You need to tell us how you know you have a new recording in the file...<br>
<br>
<br>
Loren<br>
<br>
<a href="http://blogs.mathworks.com/loren">http://blogs.mathworks.com/loren</a>

Mon, 26 Jun 2017 00:48:05 +0000
Re: fmincon optimization
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348896#954824
Tamal Roy
"Tamal Roy" <roytamaleee@gmail.com> wrote in message <oin5h1$q$1@newscl01ah.mathworks.com>...<br>
> Really need a help to solve this problem. In the unscheduled case, I have pw_matrix1 that contains 6x10x24 matrix and for lower bound and upper bound i have x_a_max_1 and x_a_min_1 that matrix also have 6x10x24 matrix.<br>
> <br>
> objective function is :<br>
> <br>
> function f = objective(x)<br>
> %Electricity price for each hour.<br>
> %Data extracted from the Central NY LMBP ($/MWHr) for 5/4/2013 Source:NYISO<br>
> LBMP = [33.11, 31.79, 28.60, 28.01, 27.73, 28.03, 26.69, 29.09, 31.43,33.20, 33.74,34.05, 34, 33.99, 33.64, 33.87, 34.25, 34.94, 34.59, 35.69, 37.56,37.60, 33.41, 32.59];<br>
> price = LBMP.*0.000001.*0.5;<br>
> f = sum(x*price');<br>
> %%%Constraints function [c,ceq] = constraint_class1 (x,B_in,S_in,F_in,L_in)<br>
> c=B_in*L_insum(log(x(S_in:F_in)+1));<br>
> ceq = [];<br>
> <br>
> x0=zeros(6,10,24);<br>
> opt_pw_matrix1 = zeros(6,10,24);<br>
> opt_pw1 = zeros(1,24);<br>
> opt_cost = zeros(6,10,24);<br>
> options=optimset('Algorithm','interiorpoint', 'Display', 'off');<br>
> <br>
> for app_num=1:3;<br>
> %Type1<br>
> [x,f]=fmincon(@objective,x0,[],[],[],[],x_a_min_1(appnum,:,:),x_a_max_1(appnum,:,:),@(x)constraint_class1(x,B_a_1(app_num),S_a_1(app_num),F_a_1(app_num),L_a_1(app_num)),options);<br>
> <br>
> but this optimization does not work... it shows this error:<br>
> <br>
> Error using * <br>
> Inputs must be 2D, or at least one input must be scalar.<br>
> To compute elementwise TIMES, use TIMES (.*) instead.<br>
> <br>
> Error in objective (line 7)<br>
> f = sum(x*price');<br>
> <br>
> Error in fmincon (line 534)<br>
> initVals.f = feval(funfcn{3},X,varargin{:});<br>
> <br>
> Error in sche_new (line 21)<br>
> [x,f]=fmincon(@objective,x0,[],[],[],[],x_a_min_1(appnum,:,:),x_a_max_1(appnum,:,:),@(x)constraint_class1(x,B_a_1(app_num),S_a_1(app_num),F_a_1(app_num),L_a_1(app_num)),options);<br>
> <br>
> Caused by:<br>
> Failure in initial usersupplied objective function evaluation. FMINCON cannot continue.

Mon, 26 Jun 2017 00:47:06 +0000
fmincon optimization
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348896#954823
Tamal Roy
"Tamal Roy" <roytamaleee@gmail.com> wrote in message <oin5h1$q$1@newscl01ah.mathworks.com>...<br>
> Really need a help to solve this problem...in the unscheduled case, I have pw_matrix1 that contains 6x10x24 matrix and for lower bound and upper bound i have x_a_max_1 and x_a_min_1 that matrix also have 6x10x24 matrix.<br>
> <br>
> objective function is :<br>
> <br>
> function f = objective(x)<br>
> %Electricity price for each hour.<br>
> %Data extracted from the Central NY LMBP ($/MWHr) for 5/4/2013 Source:NYISO<br>
> LBMP = [33.11, 31.79, 28.60, 28.01, 27.73, 28.03, 26.69, 29.09, 31.43,33.20, 33.74,34.05, 34, 33.99, 33.64, 33.87, 34.25, 34.94, 34.59, 35.69, 37.56,37.60, 33.41, 32.59];<br>
> price = LBMP.*0.000001.*0.5;<br>
> f = sum(x*price');<br>
> %%%Constraints function [c,ceq] = constraint_class1 (x,B_in,S_in,F_in,L_in)<br>
> c=B_in*L_insum(log(x(S_in:F_in)+1));<br>
> ceq = [];<br>
> <br>
> x0=zeros(6,10,24);<br>
> opt_pw_matrix1 = zeros(6,10,24);<br>
> opt_pw1 = zeros(1,24);<br>
> opt_cost = zeros(6,10,24);<br>
> options=optimset('Algorithm','interiorpoint', 'Display', 'off');<br>
> <br>
> for app_num=1:3;<br>
> %Type1<br>
> [x,f]=fmincon(@objective,x0,[],[],[],[],x_a_min_1(appnum,:,:),x_a_max_1(appnum,:,:),@(x)constraint_class1(x,B_a_1(app_num),S_a_1(app_num),F_a_1(app_num),L_a_1(app_num)),options);<br>
> <br>
> but this optimization does not work... it shows this error:<br>
> <br>
> Error using * <br>
> Inputs must be 2D, or at least one input must be scalar.<br>
> To compute elementwise TIMES, use TIMES (.*) instead.<br>
> <br>
> Error in objective (line 7)<br>
> f = sum(x*price');<br>
> <br>
> Error in fmincon (line 534)<br>
> initVals.f = feval(funfcn{3},X,varargin{:});<br>
> <br>
> Error in sche_new (line 21)<br>
> [x,f]=fmincon(@objective,x0,[],[],[],[],x_a_min_1(appnum,:,:),x_a_max_1(appnum,:,:),@(x)constraint_class1(x,B_a_1(app_num),S_a_1(app_num),F_a_1(app_num),L_a_1(app_num)),options);<br>
> <br>
> Caused by:<br>
> Failure in initial usersupplied objective function evaluation. FMINCON cannot continue.

Sun, 25 Jun 2017 21:49:05 +0000
Matlab GUI doesn't appear
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348898#954822
Giorgio Signorello
I recently moved from Windows to Ubuntu 16.04 LTS. I just dowloaded, unzipped and installed Matlab using:<br>
<br>
$ sudo ./install<br>
<br>
from the extracted folder. I tried to run Matlab from the dash, but I could not find it there.<br>
Strangely, running matlab from the terminal ($ matlab) is fine. I then rightclicked the matlab icon to add the matlab icon in the dash.<br>
<br>
When I now run Matlab from the icon in the dash, Matlab seems to start because the icon appears... but after few seconds the icon desappears again.<br>
Any idea of what could cause this?

Sun, 25 Jun 2017 20:10:55 +0000
Re: isscalar, bug?
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348866#954821
dpb
On 06/25/2017 1:13 PM, Nasser M. Abbasi wrote:<br>
...<br>
<br>
> Matlab is not really a "stongly typed" language. So you have to<br>
> take this test of scalar a little loose in its semantics.<br>
<br>
Nothing "loose" at all about itthere's a lot in documentation in <br>
Matlab that isn't precise, granted but this is not one of those cases.<br>
<br>
The return values is an object and there's only one of them in OPs case. <br>
It _IS_ a scalar of the class of its type. I don't have the toolbox <br>
so not sure if it's a fullblown class or just a structure or what, <br>
precisely, but the return value is a compound object and the size of <br>
that object determines whether it's a scalar or not, not the content <br>
within the object.<br>
<br>
That's what<br>
<br>
which<br>
whos<br>
<br>
would've made clear and why I suggested it to OP not having the TB but <br>
only the documentation. See <br>
<<a href="http://www.mathworks.com/help/control/ug/aboutmodelobjects.html">http://www.mathworks.com/help/control/ug/aboutmodelobjects.html</a>> for <br>
more details about the model objects that Matlab systems toolboxes use.<br>
<br>


Sun, 25 Jun 2017 18:19:05 +0000
Re: Subplots with one title
https://au.mathworks.com/matlabcentral/newsreader/view_thread/244434#954820
Vishnu Nair
"Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...<br>
> If your subplots have titles, you could try<br>
> suptitle, instead title<br>
> <br>
> doc suptitle for details<br>
<br>
That's the right answer.

Sun, 25 Jun 2017 18:13:10 +0000
Re: isscalar, bug?
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348866#954819
Nasser M. Abbasi
On 6/23/2017 7:16 AM, sam wrote:<br>
> How this is possible?<br>
> <br>
> H=tf([2.1 1],[3 1 1]);<br>
> isscalar(H)<br>
> ans =<br>
> logical<br>
> 1<br>
> <br>
<br>
If you look at the file isscalar.m it says<br>
<br>
%ISSCALAR True if input is a scalar.<br>
% ISSCALAR(S) returns logical 1 (true) if SIZE(S) returns [1 1] and<br>
% logical 0 (false) otherwise.<br>
<br>
Now<br>
<br>
>> size(H)<br>
Transfer function with 1 outputs and 1 inputs.<br>
<br>
And<br>
<br>
>> size(H)==[1 1]<br>
<br>
ans =<br>
1 1<br>
<br>
But not all tf's are scalare. Here is a 2 input 2 output tf:<br>
<br>
>> H = tf( {5 ; [1 5 6]} , {[1 1] ; [1 1 0]});<br>
>> isscalar(H)<br>
<br>
ans =<br>
0<br>
<br>
Matlab is not really a "stongly typed" language. So you have to<br>
take this test of scalar a little loose in its semantics.<br>
<br>
Nasser

Sun, 25 Jun 2017 15:29:16 +0000
how to use RFS filter bank to filter 10 images in matlab
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348897#954818
Jing H
I already have codes of RFS filter bank. but i don't know how to use the RFS filter bank to filter 10 images iteratively. my RFS filter bank is stored in my matlab folder 'mytask' . thanks for helping. here is my codes:<br>
<br>
clear all; clc; close all;<br>
<br>
addpath([functiondir 'mytask'])<br>
<br>
function filter_response = im2filter_response( grayim1,filters)<br>
%read image<br>
for i=1:10<br>
filename=dir(strcat('C:\Users\jing3\Documents\MATLAB\ActiveModels_version7\Fotos\', 'train*jpg'))<br>
%disp(filename(i).name);<br>
disp(size(filename));<br>
im=imread(strcat('C:\Users\jing3\Documents\MATLAB\ActiveModels_version7\Fotos\',filename(i).name));<br>
grayim=rgb2gray(im);<br>
%imtool(im);<br>
imshow(grayim);<br>
end<br>
<br>
filters=makeRFSfilters<br>
filterresponse = zeros(size(grayim1))<br>
for k=1:size(filters,3)<br>
<br>
filterresponse = fft2(double(grayim1),filters(:,:,k),'same');<br>
<br>
end;<br>
<br>
imshow(grayim1);<br>
imshow(filterresponse);<br>
end

Sun, 25 Jun 2017 13:42:49 +0000
Re: isscalar, bug?
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348866#954817
dpb
On 06/25/2017 5:43 AM, sam wrote:<br>
...<br>
<br>
> tf() is matlab's builtin function for transfer function, so just<br>
> copy/paste the following:<br>
> H=tf([2.1 1],[3 1 1]);<br>
> isscalar(H)<br>
><br>
> Since H is not a scalar, the result should not be 1..<br>
<br>
<br>
> tf([2.1 1],[3 1 1])<br>
Undefined function 'tf' for input arguments of type 'double'.<br>
>><br>
<br>
Not everybody has every toolbox... :(<br>
<br>
But, making certain plus it would've answered your question for you in <br>
all likelihood.<br>
<br>
From the doc <<a href="http://www.mathworks.com/help/control/ref/tf.html">http://www.mathworks.com/help/control/ref/tf.html</a>><br>
<br>
> "...<br>
> The output sys is:<br>
><br>
> A tf model object, when Numerator and Denominator are numeric arrays.<br>
> ..."<br>
<br>
The output _IS_ a scalar, it is one instantiation of the tf object class.<br>
<br>


Sun, 25 Jun 2017 13:03:04 +0000
Re: [MAC] Matlab icon in Finder does not display
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348284#954816
Francesco Bonaldi
Same here, although I was not upgrading from a previous release. It happens only with .m files, not with .fig or .mat files, as an example. Right after finishing the setup process, icons were correctly displaying also on .m files, but after a while they became blank/generic. Tried every possible solution, including uninstalling and reinstalling, to no avail. That's pretty annoying...<br>
<br>
"Mason Law" wrote in message <odegkb$5p2$1@newscl01ah.mathworks.com>...<br>
> I updated Matlab from R2015b to R2017a and in doing so, all old and newly created matlab files (.m) have no icon next to them, Ratherm they have the generic white sheet (kind of like a .txt file icon). Does anyone have any ideas on how to fix this?<br>
> <br>
> Matlab runs perfectly, but files simply do not have the matlab icon next to it in Finder.<br>
> <br>
> I have tried restarting my Mac while holding Option + Command  no change<br>
> I have tries clearing my icon cache  no change<br>
> <br>
> Thanks in advance!

Sun, 25 Jun 2017 10:43:04 +0000
Re: isscalar, bug?
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348866#954815
sam
"dpb" wrote in message <oij2bd$qcl$1@dontemail.me>...<br>
> On 06/23/2017 7:16 AM, sam wrote:<br>
> > How this is possible?<br>
> ><br>
> > H=tf([2.1 1],[3 1 1]);<br>
> > isscalar(H)<br>
> > ans =<br>
> > logical<br>
> > 1<br>
> <br>
> show us what<br>
> <br>
> whos tf<br>
> which tf<br>
> <br>
> return<br>
> <br>
> <br>
> <br>
> <br>
<br>
tf() is matlab's builtin function for transfer function, so just copy/paste the following:<br>
H=tf([2.1 1],[3 1 1]);<br>
isscalar(H)<br>
<br>
Since H is not a scalar, the result should not be 1..

Sun, 25 Jun 2017 07:41:04 +0000
Re: Specifying Neural Network Output Types
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348867#954814
Greg Heath
"Akshar Agarwal" wrote in message <oij0qp$hr3$1@newscl01ah.mathworks.com>...<br>
> I am creating a neural network from the command line following Matlab's guide, but the only two values that my target can take on are 0 and 1. It either is, or isn't. However, the neural network returns values that are 1.1, 1.5, etc. Can I specify somehow that it should predict values of either 0 or 1?<br>
<br>
Insufficient information.<br>
<br>
If this is a 2 class classifier you have several choices<br>
<br>
1. Two outputs or one output<br>
2. Logsig or softmax output function<br>
<br>
The simplest is logsig with one output. To get 0 or 1 simply ROUND the output.<br>
<br>
Hope this helps.<br>
<br>
Greg

Sun, 25 Jun 2017 07:06:07 +0000
Re: Specifying Neural Network Output Types
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348867#954813
Greg Heath
"Akshar Agarwal" wrote in message <oij0qp$hr3$1@newscl01ah.mathworks.com>...<br>
> I am creating a neural network from the command line following Matlab's guide, but the only two values that my target can take on are 0 and 1. It either is, or isn't. However, the neural network returns values that are 1.1, 1.5, etc. Can I specify somehow that it should predict values of either 0 or 1?<br>
<br>
Insufficient information.<br>
<br>
If it is a classifier with c distinct classes <br>
<br>
1. the training function should be PATTERNNET<br>
2. the output function should be SOFTMAX (the default)<br>
<br>
help patternnet<br>
doc patternnet<br>
<br>
3. The target columns should be columns from the unit matrix eye(c)<br>
that enforces unit sum nonnegative outputs that are interpreted as <br>
input conditional posterior probabilities. <br>
<br>
4. The classification is assigned to the class with the maximum posterior.<br>
<br>
Search the NEWSGROUP and ANSWERS using<br>
<br>
greg patternnet<br>
<br>
Hope this helps.<br>
<br>
Greg

Sun, 25 Jun 2017 06:40:09 +0000
Re: Specifying number neural units of each hidden layers in Neural Network
https://au.mathworks.com/matlabcentral/newsreader/view_thread/348875#954812
Greg Heath
"Hien Quang Bui" wrote in message <oij0qr$hrf$1@newscl01ah.mathworks.com>...<br>
> Dear Mr. Greg,<br>
> <br>
> I use app to generate NARX model. How can I specify number neural units of each hidden layers in Neural Network?<br>
> <br>
> Input = 4<br>
> <br>
> Hidden layer1: 3 neural units<br>
> <br>
> Hidden layer2: 3 neural units<br>
> <br>
> Output=1<br>
> <br>
> Thank you very much!<br>
> Best,<br>
> Hien Bui<br>
<br>
1. I never use more than 1 hidden layer<br>
2. I use divideblock to ensure only predicting the future with the past<br>
3. I minimize H subject to the constraint that mse(etrn) <= 0.01 var(ttrn,1)<br>
<br>
Details are in my NEWSGROUP and ANSWERS posts. Search on<br>
<br>
greg narxnet<br>
<br>
Hope this helps.<br>
<br>
Greg