creating GUI in matlab out of some programs written in matlab
I have written some code in matlab for my application. I want to make a graphical interface so that an user can easily use my code. I do not know, how to link my code or a particular function when user clicks on a particular button. I mean, how to assign a function written by me to a push button so that it will execute the function. And how to give the input to my function and get output after executing the particular function.
I am quiet familiar with matlab code. But I am absolutely new with GUI in matlab. Please help me to deal with the above problem.
On 4/12/2011 12:37 AM, sk maidul haque wrote:
> I have written some code in matlab for my application.
> I want to make a graphical interface so that an user can easily use my code.
> I do not know, how to link my code or a particular function
> when user clicks on a particular button. I mean, how to assign a
> function written by me to a push button so that it will execute the function.
> And how to give the input to my function and get output after
> executing the particular function.
> I am quiet familiar with matlab code. But I am absolutely new with
> GUI in matlab. Please help me to deal with the above problem.
Use GUIDE to make the gui. It is very simple and powerful to use.
I use it all the time for my school projects and HW's. I know some
prefer to code the thing by hand, but I prefer GUIDE.
When you add a button in GUIDE, it will create a callback stub for
you automatically...slow optimization using nonlcon with GA within matlab toolbox and mixed integer problem using GA within Matlab
i'm using nonlcon(nonlinear inequality constraint) with GA from the toolbox provided by matlab. does anyone notice the extreme slowlness in evaluating nonlinear constraint as compared to other linear constraint?
my problem for nonlinear constraint is as follow
where x and y are Nx1 vector.
which means if N increases, the size of constraint increases.
and to clarify, the min problem is sometime like
where z=[x;y], which means x and y are some range of variable within z(just a matter of problem formulation)
well, is there anyone with other alternative or is it possible or method in including non-linear constraint directly to fitness function?
(well, actually nonlcon deals nonlinear constraint by using Augmented Lagrangian Pattern Search from what i see from the help file, or am i wrong?)
and one more question, is there anyone that attempt to attempt to apply mixed integer problem into the GA in matlab?
For now, i can only switch before pure integer or pure real number problem, but not mixed at the moment. I will be trying to add in some repair operator to fix up the variable that needs to be integer and other remaining in real number.
I'm not sure why you are using ga to solve your problem. Did you find
fmincon unsatisfactory in any way?
MATLAB mathematical toolbox documentation
On 5/10/2011 11:53 PM, terry wrote:
> greeting all,
> i'm using nonlcon(nonlinear inequality constraint)...Matlab engine with matlab R2010b
I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡
...Spawning matlab from within matlab
I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes.
...matlab 7.1 use matlab C++ math library
I wanna use matlab C++ math library into VC++6.0, but my matlab is 7.1. if i wanna use matlab C++ math library to programme, how can i setup my VC link?? why matlab7.1 doesn't have "extern->include->cpp" file???
In using matlab C++ math library , what difference between matlab 6.X and matlab7.1???
...time trial version of matlab compiled code using the matlab compiler
is there any way to create a time trial version of a program compiled using the matlab compiler?
...Problem using matlab created dll when <Library>Initialize() is in code
I am running into a problem which can be best descrivbed as below:
I have a C++ program which calls a matlab created library (compiled with MSVC2008). I am using Qt Creator as IDE and the program is being compiled with MSVC2008 as well. I followed all the instructions regarding the dll compilation and how to integrate it to my code (MCR installation, etc.). I then set up my project file this way:
1. an includepath to the folder where the .lib, .dll, .h have been created D:/C++ Offline/Matlab/
2. an includepath to .../MATLAB Compiler Runtime/v714/extern/include
3. I link the following libraries
D:/C++ Offline/Matlab/Test_Matlab.lib (the library I created)
C:/Program Files/MATLAB/MATLAB Compiler Runtime/v714/extern/lib/win32/microsoft/mclmcrrt.lib
4. I added also #include "Test_Matlab.h"
Here is the problem: When I compile the application and when calling mclInitializeApplication(NULL, 0) everyhing works ok (including the connection to matlab as the boolean returned evaluates to true) AS LONG AS Test_MatlabInitialize() is NOT in the code (even if it is not called at startup). However as soon as I add in the code Test_MatlabInitialize() (even if not called) I get the following error:
Stopped in thread 0 by: Exception at 0x1cdb4a, code 0xc0000005: write access violation at: 0x8, flags=0x0
What I don't understand is that it seems to be able to compile bu not to run the program (crashes immediately) even if the function Tes...Generate dll in msvc++ using matlab generated dll
I generated a dll using the matlab command mcc. Then made a project( win32 console application project) in msvc++ using this dll and other files generated from matlab. Wrote a main function as the procedure in the matlab compiler help. That project run wihout any error and got the correct output.
Now I want to generate a dll for the entire project( above mentioned ). How can I use the matlab generated dll for generating dll in msvc++?
...Problem in creating the simulation dll using SIT 2.0.3,matlab 7.1,labview 7.1
I am currently using SIT 2.0.3 ,using this toolkit i am trying to create the simulation DLL for labview.but i am getting the following error in matlab command window
Error: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 117 Column: 7Undefined identifier ReleaseVersionError: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 117 Column: 25The == and != operators can only be used to compare values of the same typeError: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 260 Column: 26Undefined identifier ReleaseVersionError: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 260 Column: 44The == and != operators can only be used to compare values of the same type
Is this a version problem?
I am using
Simulation interface toolkit 2.0.3
Matlab 184.108.40.206(R14) Service pack
Real time workshop V.6.3
Microsoft visual C++ 6.0
Can anybody help me to solve this issue.
Hi, Unfortunately, it looks like the versions you are using are indeed not compatible. Here is an excerpt from the <a href="http://ftp.ni.com/support/softlib/labview/labview_toolkits/simulation_interface/2.0.3/sit_2_0_3_readme.html" target="_blank">Read Me file</a> for Simulation Interface Toolkit 2.0.3:
To use the Simulation Interface Toolkit 2.0.3, you must
be a properly licensed user of and have the following software
installed on the host computer.
- The MathWorks MATLAB ver...embedded matlab function MATLAB R2009a
I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in
My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked.
Thanks to the contribution from above!
...Calling a MATLAB created DLL
Is it possible to create a DLL in MATLAB (using deploytool) and call it in MATLAB?
I failed to do so. Any help is appreciated
...Using matlab dll in c#
Does anyone now where I can found example code on how to use dll
objects (created in Matlab) in .NET Visual C#
Jakes Windell wrote:
> Does anyone now where I can found example code on how to use dll
> objects (created in Matlab) in .NET Visual C#
read the part about "access with dll"
Below is an example that works for calling a MATLAB Compiler 4.0 (R14)
generated DLL from C#...
Copy the following code and save it as timestwo.m:
function y = timestwo(x)
y = 2*x;
This function multiples the input by two and then displays a line plot.
Now execute "mbuild -setup" and select your Microsoft compiler. Generate
the shared library by executing:
mcc -B csharedlib:libtimestwo timestwo.m
Note that, in order to call the generated DLL, the DLL must reside either in
the same directory as your executable or in a directory on your system path.
For help in how to modify the system path, see:
Also, if you move the generated DLL to another directory, be sure to also
move the associated CTF-file to the same directory.
Open Microsoft Visual Studio .NET. Select File->New->Project. Then select
Visual C# Applications in the left pane and Console Application in the right
pane. Click OK and some automatically generated code will appear. Replace
this code with:
using Syst...What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit)
What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit)
I’m trying to import historical prices of stock data. Matlab keeps cutting off the header of each column; it gives me only values. I am thinking that this is a data-type-mixing-issue, or whatever it’s called.
I have ‘Dates’ in ColumnA, and ‘MSFT’, ‘PWER’, ‘KO’, and ‘SBUX’, in ColumnB-ColumnE.
Basically, if I put the Excel file in my Matlab folder and double-click the file, I see the values in a matrix (no dates and no headers), I hit ‘Next’. Then, I see only one option; one radio button is enabled – ‘Create variable matching preview’. The other two options, ‘Create vectors from each column using column names’ and ‘Create vectors from each row using row names’ – both are greyed out. I’ve seen videos, on YouTube and on the Matlab site, where people import excel data and these options are NOT greyed out. No matter what I do, there options are ALWAYS greyed out. The problem is, when I click ‘Finish’ in my ‘Workspace’ I have a variable named ‘data’ all values in a 575x4 matrix, but I have NO DATES and I have NO HEADERS on the columns. All of this seems to go into another variable, called ‘textdata’; all dates and headers ate in textdata. This is VERY inconvenient. I’m trying to
analyze some stock data and I have no headers, so I have no idea which stock is which (I can figure it out, but I think Matlab should do this for me). Also, I have no dates corresponding to ...Shall i use the misrosoft Visual c++ code from a m-file generated from matlab in Visual C++ with out matlab runtime environment
...Re: How to create a DLL for LabVIEW in MatLab
You can use only the Matlab runtime.
Install the runtime and the libraries that you are using.
...Why does Matlab do this
What is happening when I type
at the command line?
Matlab goes into a 10 minute spin - what's going on?
"Robert" wrote in message <firstname.lastname@example.org>...
> What is happening when I type
> at the command line?
> Matlab goes into a 10 minute spin - what's going on?
Hi Robert, You're create a 10-D array with that syntax. Do you just want a vector of 10 uniformly distributed random numbers.
x = rand(10,1); % or x = rand(1,10);
You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it!
Thanks for the explanation.
"Robert" wrote in message <email@example.com>...
> Hi Wayne,
> You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it!
> Thanks for the explanation.
That's fine. Welcome to MATLAB!!! If that's the worst memory-intensive mistake you ever make, you'll be fine :) I've done much, much worse.
...Matlab 2011: matlab coder (build failed)
When I create a MATLAB Coder Project and try to convert this function:
function y = myResampler(x,m,n) %#codegen
fsVec = [8000 16000 32000 48000];
targetFsVec = [8000 16000 32000 48000];
fs = fsVec(m);
targetFs = targetFsVec(n);
y = resample(x,targetFs,fs);
to C-code I get a build error saying:
coder -build resamplerproj.prj ??? The upsample factor P must be constant.
Error in ==> myResampler Line: 12 Column: 5 Code generation failed: Open
But I want to be able to resample x using a variable P/Q ratio.
Is this just a limitation of Matlab Coder or am I doing something wrong??
> When I create a MATLAB Coder Project and try to convert this function:
> function y = myResampler(x,m,n) %#codegen
> fsVec = [8000 16000 32000 48000];
> targetFsVec = [8000 16000 32000 48000];
> fs = fsVec(m);
> targetFs = targetFsVec(n);
> y = resample(x,targetFs,fs);
> to C-code I get a build error saying:
> coder -build resamplerproj.prj ??? The upsample factor P must be
> constant. Error in ==> myResampler Line: 12 Column: 5 Code generation
> failed: Open error report.
> But I want to be able to resample x using a variable P/Q ratio.
> Is this just a limitation of Matlab Coder or am I doing something wrong??
Apparently it's a limitation of RESAMPLE ...Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors
to the MATLAB Central File Exchange. Look for your favorite
contributors on our File Exchange Author Profile page. You can read
their profiles and see pictures:
In a random drawing, we recently awarded MATLAB jackets to three File
Exchange authors with profile pages: Michele Giugliano, Andrey Egin,
and Denis Gilbert.
You can win a jacket, too. Just submit a new file to the File
Exchange or update your author profile by December 2003 for a chance
to win one of four MATLAB jackets. See the jacket below:
Here are some interesting File Exchange facts:
- Since its inception in 2001, visitors have downloaded more than
1.25 million submissions from the File Exchange.
- In September 2003 alone, visitors downloaded 80,085 files, an
average of 2670 a day!
.... what if the prize was a free copy of the next version of Matlab :-)
Min Poh wrote:
....or an offer for employment...
"bourassa" <firstname.lastname@example.org> wrote in message
> ... what if the prize was a free copy of the next version of Matlab :-)
> Min Poh wrote:
...code of matlab 7a not working in matlab 2009
I wrote a code in matlab 7a andand it was working over there
then i changed computer which was having matlab realease 2009a and it is not working
If i install Matlab 7 release 14, will my code work again thanks
"moonman" wrote in message <email@example.com>...
> I wrote a code in matlab 7a andand it was working over there
> then i changed computer which was having matlab realease 2009a and it is not working
> If i install Matlab 7 release 14, will my code work again thanks
Can you be more specific about the fact that your code is not working in 2009a but worked in 2007a? It would be helpful if you could narrow down what is not working in 2009a and provide error messages.
ok thanks wyne i will send error message after some hours
...Using vsgDesktop to create Gabor in Matlab
I'm trying to use the Cambridge Research Systems vsgDesktop toolbox to display a Gabor patch on a second monitor. Specifically, I want to display a sequence of Gabor patches with various contrasts.
As far as I've tried, the crsDrawGabor() command does not accommodate this - it displays a Gabor, for which you can alter the size of the Gabor, but that's it. I can't change the contrast, spatial frequency, or anything else using this command.
So what I want to do is to use vsgDesktop to display a sequence of Gabor patches, for which I can alter their spatial frequency and contrast settings (0% to 100%).
Can anyone help me on this?
I just came across your post and don't know if you are still interested in obtaining help with this, but I recommend using the CRS MATLAB Toolbox for the VSG. It is easy to interface to and is a free download for registered VSG systems.
You can view the product information at this website:
"Jeremy" wrote in message <firstname.lastname@example.org>...
> I'm trying to use the Cambridge Research Systems vsgDesktop toolbox to display a Gabor patch on a second monitor. Specifically, I want to display a sequence of Gabor patches with various contrasts.
> As far as I've tried, the crsDrawGabor() command does not accommodate this - it displays a Gabor, for which you can alter the size of the Gabor, but that's it. I can't change the cont...How to use matlab generated dll in .NET
I have create a dll using matlab which include a .dll file ,.ctf file and a .h header file.
Now i want to use that dll in a c#.net project.
I facing a problem when i am giving the reference to the matlab dll it is giving a error stating "dll could not be added please make sure the file is accessible, and is a valid assembly COM object"
So NOBODY help ???? There are some moderator administrator support reading this forum or these pages are just a joke ???
"Yogesh Iparkar" <email@example.com> wrote in message <firstname.lastname@example.org>...
> I have create a dll using matlab which include a .dll file ,.ctf file and a .h header file.
> Now i want to use that dll in a c#.net project.
> I facing a problem when i am giving the reference to the matlab dll it is giving a error stating "dll could not be added please make sure the file is accessible, and is a valid assembly COM object"
> Please help!
"Dominique " <email@example.com> wrote in message
> So NOBODY help ???? There are some moderator administrator support reading
> this forum or these pages are just a joke ???
> "Yogesh Iparkar" <firstname.lastname@example.org> wrote in message
>> I have create ...matlab use
suggest me the online tutorial of MATLAB .
On 2/27/2012 2:06 AM, azim kumar wrote:
> suggest me the online tutorial of MATLAB .
Best way to learn any language is to solve a simple
problem you are familiar with. This way you know what
the answer should be, and it is a matter of coding it
to obtain the answer, and you'd have a goal to work for.
Matlab itself has many on-line tutorials. Help->Online tutorials.
...Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow:
for i = 1:length(vector1) % length is 25
for j = 1:length(vector2) % length is 16000
temp1 = vector1(i);
temp2 = vector2(j);
t1 = load(matfiles1(temp1).name) %load image1 from matfile1
t2 = load(matfiles2(temp2).name) % load image2 from matfile2
It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance!
...how to do this in matlab
Number of column: 5
Vector A: [ 2 4 6 7 8 ]
Vector B : [ 5 7 8 10 1]
Choice = 1 : Find the highest value
Vector A : 8
Vector B: 10
The highest value : 10
Choice = 2 : Find the lowest value
Vector A : 2
Vector B: 1
The highest value : 1
Choice = 3 : Find the average value of :
"Syamil " <email@example.com> wrote in message <firstname.lastname@example.org>...
> Number of column: 5
> Vector A: [ 2 4 6 7 8 ]
> Vector B : [ 5 7 8 10 1]
> Choice = 1 : Find the highest value
> Vector A : 8
> Vector B: 10
> The highest value : 10
> Choice = 2 : Find the lowest value
> Vector A : 2
> Vector B: 1
> The highest value : 1
> Choice = 3 : Find the average value of :
> Vector A
> Vector B
Type in matlab: