Popup value in Simulink Mask doesn't refresh - matlab

I am currently masking a block in simulink.
The mask contains a popup list called dbclist with hardcoded type options (1, 2, 3, ..., 7).
The callback function of said popup list looks like this:
msk = Simulink.Mask.get(gcb);
dbcPopup = msk.getParameter('dbclist');
dbcPopup.Value
When changing the value of dbclist while using the mask the command window always responds with:
ans =
1
ans =
1
ans =
1
How can I get the actual value of dbclist?
I am using MATLAB 2014b on Mac OS X.

As stated here (http://de.mathworks.com/matlabcentral/answers/290286-popup-value-in-simulink-mask-doesn-t-refresh) I have found another way to get the actual value of my popuplist. I still don't know what is wrong with the first approach. If anyone figures out where the error is I would really appreciate telling me.

Related

Why MATLAB returns an error using `conv` function?

I'm using MATLAB 2015a. Even if I try to run document example of conv function, i get an error saying Error using conv (line 15), Not enough input arguments..
This is the example code I'm using:
u = [1 0 1];
v = [2 7];
w = conv(u,v)
What is the problem with my MATLAB?
It is hard to find the documentation for that version online without a license. You can find the documentation for your version by typing
help conv
Presumably the interface changed after your version. So you have to see what your documentation says.
FWIW, the documentation archives are here, but I cannot access them.
Also, I tried your code in Matlab 2015b (that is, b, not a), and it worked. So it must have changed between those two versions.
According to excaza, the docs haven't changed. So, like they say, it must be a shadowing issue. You would verify that by using clear all before your code snippet.

Basic bag on the return value of a function on matlab

Consider the matlab function that describe in the image.
enter image description here
As I run this function, I get that y = 1 insted of y = 7 as expected.
Why is this happening?
any response will be appreciated.
Thanks!
Because the while gets false from the first iteration and stop.
use while (a>=v(j)) to resolve your issue.

Matlab function area() not working

The in-build matlab function area() stopped working.
I tried to run the example from the documentation:
Y = [1, 5, 3;
3, 2, 7;
1, 5, 3;
2, 6, 1];
figure
area(Y)
but I would get the error message
Error using area (line 35)
Too many input arguments.
I am using 8.5.0.197613 (R2015a).
This CW answer was created to indicate that this question was resolved.
This turned out to be an issue related to the MATLAB search path. Using restoredefaultpath resolved it.
A symptom of this problem can appear when running which -all <function name> (without the <>), and getting back a list with unexpected entries.
From the documentation of which:
The results are ordered according to the Function Precedence Order, unless they are shadowed. Among shadowed results, you should not rely on the order of the functions and methods in str. To determine if a result is shadowed, call which without specifying an output. which indicates shadowed results by the comment, % Shadowed.

matlab function "m = size(X,dim)" equivalent in opencv

I am new to Matlab, can anyone help me to find the equivalent opencv method for the matlab method "m = size(X,dim)"". It would also be better if i get to know what it does? The online documents are not helpful for my little knowledge. Thanks
Update:
What is the role of Dim "m = size(X,dim)" and how it works. For the image(x) size of 200 * 200 , if i pass dim=1, i get m=1 in matlab and if i pass dim =2 , then i get 40. Can you pl explain.
Code:
image = 'D:\Proposals\others\test_some_title1.jpg'
top=size(image,2)
As to your code:
image = 'D:\Proposals\others\test_some_title1.jpg'
top=size(image,2)
image here is not an image. It is a string containing a file name (which happens to be an image, but the size function doesn't know that). The string is indeed 40 characters long, hence the result. To actually read in an image, use imread.
Also, image itself is a function in MATLAB. If you make a variable called image it will stop you using the function properly (this is the source of a lot of MATLAB errors).
Your title pretty much answers how to access the dimension. You use the size command. I'm not even sure why this question was even asked. http://www.mathworks.com/help/matlab/ref/size.html. Doing a Google search, this was the first link that came up.
Referring to your code
You did not read in the image properly. You are checking the size of the string that contains the filename. You didn't read in the image itself. Call imread first via:
im = imread('D:\Proposals\others\test_some_title1.jpg');
Now do:
top = size(im, 2);
The reason why you get a 1 x 40 size is because your filename string is 40 characters long.
Also, referring to what #nkjt said, you should not shadow over the image command with a variable called image. image is used to take a matrix and display it on the screen as an image. Bear in mind this is not the same as imshow. Suggest you change the variable name to something like im like what I did.
I got your point. Because this function "m = size(X,dim)" finds the size of each dimension of your matrix X, you get answer 1 when you input dim = 1, and 40 when you input dim = 2.
your input message 'D:\Proposals\others\test_some_title1.jpg' is read as a matrix. It has one row and 40 columns. So dimension of X will be 1x40.
To answer your question, what I understood is the matrix X now has dimension 1x40. one row and 40 columns. if you want to know the size of first dimension, you type m = size(X,1). You will get m = 1. For the second dimension which is 40, you type m= size(X,2), you will get 40. Because this matrix X has only two dimension, if you type a number greater than 2, matlab will return default value 1. You don't care about that!

Can you give me an example of comm.FSKModulator along with it's step function?

Can you tell me how to use PSKModulator with it's step function. I was able to solve comm.PSKModulator usage like this:
>> H=comm.FSKModulator('ModulationOrder',2,'BitInput',false,'SymbolMapping','Binary','FrequencySeparation',10);
but when I try to run Step function that takes H and X as arguments (X is digital values that I would like to encode in H) I get an error.
>> X=[0 1];
>> Y=step(H,X);
Error:
Error using FSKModulator/step
Multichannel operation is not supported.
I looked through Internet but there is no much of examples as this functions are very fresh.
do you know how to set up this?
Thank you
Each column is treated as a different channel by this object. You need to send a column vector as input to the step method. In your code try using Y = step(H,X.') or change X to X = [0; 1];.