Search Results

Search found 1051 results on 43 pages for 'matlab'.

Page 4/43 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Corner Cases, Unexpected and Unusual Matlab

    - by Mikhail
    Over the years, reading others code, I encountered and collected some examples of Matlab syntax which can be at first unusual and counterintuitive. Please, feel free to comment or complement this list. I verified it r2006a. set([], 'Background:Color','red') Matlab is very forgiving sometimes. In this case, setting properties to an array of objects works also with nonsense properties, at least when the array is empty. myArray([1,round(end/2)]) This use of end keyword may seem unclean but is sometimes very handy instead of using length(myArray). any([]) ~= all([]) Surprisigly any([]) returns false and all([]) returns true. And I always thought that all is stronger then any. EDIT: with not empty argument all() returns true for a subset of values for which any() returns true (e.g. truth table). This means that any() false implies all() false. This simple rule is being violated by Matlab with [] as argument. Loren also blogged about it. Select(Range(ExcelComObj)) Procedural style COM object method dispatch. Do not wonder that exist('Select') returns zero! [myString, myCell] Matlab makes in this case an implicit cast of string variable myString to cell type {myString}. It works, also if I would not expect it to do so. [double(1.8), uint8(123)] => 2 123 Another cast example. Everybody would probably expect uint8 value being cast to double but Mathworks have another opinion. a = 5; b = a(); It looks silly but you can call a variable with round brackets. Actually it makes sense because this way you can execute a function given its handle. a = {'aa', 'bb' 'cc', 'dd'}; Surprsisingly this code neither returns a vector nor rises an error but defins matrix, using just code layout. It is probably a relict from ancient times. set(hobj, {'BackgroundColor','ForegroundColor'},{'red','blue'}) This code does what you probably expect it to do. That function set accepts a struct as its second argument is a known fact and makes sense, and this sintax is just a cell2struct away. Equvalence rules are sometimes unexpected at first. For example 'A'==65 returns true (although for C-experts it is self-evident). About which further unexpected/unusual Matlab features are you aware?

    Read the article

  • Undocumented Secrets of MATLAB-Java Programming, un livre de Yair Altman, critique par Jérôme Briot

    Undocumented Secrets of MATLAB-Java Programming de Yair Altman D'après l'éditeur : Citation: For a variety of reasons, the MATLAB®-Java interface was never fully documented. This is really quite unfortunate: Java is one of the most widely used programming languages, having many times the number of programmers and programming resources as MATLAB. Also unfortunate is the popular claim that while MATLAB is a fine programming platform for prototyping...

    Read the article

  • MATLAB Builder NE crash apppool on IIS 7.5

    - by Alkersan
    Im developing a web user interface for MATLAB functions with ASP.NET. Ive started with studying demos and stucked with such problem. I created a MyComponent.dll assembly with deploytool from MATLAB 2010a, target framework - 3.5. This component has one function GetKnot() which returns a figure. function df = getKnot() f = figure('Visible', 'off'); knot; df = webfigure(f); close(f); end Then I made simple webapp in visual studio 2008 sp1, with only one page Default.aspx. I added references to MWArray.dll, WebFiguresService.dll and MyComponent.dll. The codeBehind is: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using MyComponent; using MathWorks.MATLAB.NET.WebFigures; namespace MATLAB_WebApplication { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var myComponentClass = new MyComponentClass(); var x = myComponentClass.getKnot(); //WebFigureControl1.WebFigure = new WebFigure(); } } } When I run this page on Visual Studio`s Development web server - everything is fine, figure works. But when I`m trying to deploy webfigure on my local iis 7.5 which runs on Win7 x32 - iis app pool crashes. There is an entry in System Event Log "A process serving application pool 'Classic .NET AppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was '3676'. The data field contains the error number 6D000780". This happens when MyComponent is instantiating. What I could forget when moved to IIS? Other examples, like magic square console application, runs perfect, and every matlab component instantiating, but not in IIS environment.

    Read the article

  • VB.Net plugin using Matlab COM Automation Server...Error: 'Could not load Interop.MLApp'

    - by Ben
    My Problem: I am using Matlab COM Automation Server to call and execute matlab .m files from a VB.Net plugin for a CAD program called Rhino 3D. The code works flawlessly when set up as a simple Windows Application in Visual Studio, but when I insert it (and make the requisite reference) into my .Net plugin and test it in the CAD program I get the following error: "Could not load file or assembly 'Interop.MLApp, Version 1.0.0.0, culture=neutral, PublicKeyToken=null' or one of its dependencies. the system cannot find the file specified." What I've Tried: I am baffled as to why this occurs, but I was able to contact the CAD program's technical support staff and they suggested that it has something to do with their DotNet SDK having trouble with references that are located far outside the CAD program directory. They didn't have any solutions so I tried playing around with copylocal and this made no difference. I tried using other COM libraries and the Open Office automation server works fine, although uses url's instead of requiring a reference. I also tested Excel, which does require a reference, and it returned the error: "retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154." This may or may not be related to the issue with the Matlab COM reference, but I thought was worthwhile to share. Perhaps is there another way to reference Interop.MLApp? I would appreciate any suggestions or thoughts on how I might make the Matlab Interop.MLApp reference work. Best regards, Ben

    Read the article

  • Matlab and .net problem with character string function input

    - by Peter
    I have a MATLAB function that I've compiled into a .net library. The function is a simple one that takes a character array as an input and a numeric array as output: function insert = money(dateLimit) .. insert = [1 2]; The function works fine when no function arguments are specified (a default argument is provided inside the function) Dim sf As New SpreadFinder.SpreadFinder Dim output = sf.money() As soon as an argument is specified .net complains. I'm thinking this should be easy and has been done before but searching through MATLAB documentation doesn't offer much help. Here's what I've tried. The sf.money() overload for the function with arguments is (numArgsOut as Integer, argsOut as MWArray, argsIn as MWArray) and hence that's what I've tried. What am I missing? Dim sf As New SpreadFinder.SpreadFinder Dim inputArgs(1) As Arrays.MWCharArray Dim dateLimitString As String = "some string" inputArgs(0) = New Arrays.MWCharArray(dateLimitString) Dim outputArgs(1) As Arrays.MWNumericArray outputArgs(0) = New Arrays.MWNumericArray() sf.money(1, outputArgs, inputArgs) Gives System.NullReferenceException : Object reference not set to an instance of an object. at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction(String functionName, Int32 numArgsOut, Int32 numArgsIn, MWArray[] argsIn) at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction(String functionName, Int32 numArgsOut, MWArray[]& argsOut, MWArray[] argsIn) at SpreadFinder.SpreadFinder.money(Int32 numArgsOut, MWArray[]& argsOut, MWArray[] argsIn)

    Read the article

  • Matlab and MrVista

    - by AnnaRaven
    I'm new to MATLAB and mrVista. I'm running Matlab Version 7.8.0.347 (R2009a) 32-bit(win32) from February 12, 2009 OS is Windows 7 Professional I downloaded the most recent MrVista_hourly.zip and extracted it into my C:\Program_Files_(x86)\MATLAB directory. I think I need to run mrvInstall, but when I do, I get the following: EDU>> mrvInstall Checking VISATSOFT installation. Windows, 32-bit, installation Checking and possibly installing .NET framework. This can take several minutes Checking for visualization library (.dll) files. You are missing msvcp70.dll. So, I'm completely lost at this point. Do I just need to download msvcp70.dll from the net? If so, is there a safe place to download it from? If there's some other way I'm supposed to get mrVista to work from MATLAB, instead of mrvInstall, please let me know that. Thanks in advance for your help. EDIT: I've downloaded and installed the dll and still isn't working. I'll go ask on Super User. Thanks for trying to help anyway.

    Read the article

  • loading multiple .mat files in MATLAB

    - by smilingbuddha
    I have 110 files named time1.mat, time2.mat ..., time110.mat. I want to load these matrices into the MATLAB workspace. I have always used load -'ASCII' matrix.mat to load an ASCII matrix file in the current folder. So I tried doing for i=1:10 filename=strcat('time',int2str(i),'.mat'); load -'ASCII' filename end But I am getting a MATLAB error as ??? Error using ==> load Unable to read file filename: No such file or directory. ? Of course the string filename seems to be evaluated correctly by MATLAB as time1.mat. in the first iteration where it crashes at the load line. Any suggestions how I should do this?

    Read the article

  • MATLAB for kids?

    - by yuk
    My seven-years old expresses large interest in computers (well, who doesn't? :). Since I'm mostly program in MATLAB, I'm thinking why not to teach him MATLAB. We did a small project with him (he had to solve as many simple arithmetic problems as possible in a limited time) and he get pretty excited. I coded, he watched and then tested. He also likes to do create interesting graphics and simple animations. So, what's next? I would appreciate any ideas for interesting projects, games, graphics? What math concepts he has to understand to program in MATLAB? Or may be you would say it's too early and we should start with something like Logo, Scratch or Alice?

    Read the article

  • MySQL and Matlab

    - by Shaihi
    I want to interact with a MySQL database from Matlab. I found a mysql "library" for matlab here and the same on mathworks. I followed the instructions to compile the library and the compilation seems to be successful. I get a mex32 file at the end. Only, the instructions on the first page refer to a Dll that I need to use (I guess that a Dll was supposed to be generated). I am not familiar with the mex compiler or with compiling external modules for Matlab. Am I missing something trivial? Where is the Dll supposed to be? Thanks.

    Read the article

  • Getting help on MATLAB's com.mathworks internals

    - by Richie Cotton
    It is possible to access bits of MATLAB's internal java code to programmatically change MATLAB itself. For example, you can programmatically open a document in the editor using editorServices = com.mathworks.mlservices.MLEditorServices; editorServices.newDocument() %older versions of MATLAB seem to use new() You can see the method signatures (but not what they do) using viewmethods. viewmethods(com.mathworks.mlservices.MLEditorServices) I have a few related questions about using these Java methods. Firstly, is there any documentation on these things (either from the Mathworks or otherwise)? Secondly, how do you find out what methods are available? The ones I've come across appear to be contained in JAR files in matlabroot\java\jar, but I'm not sure what the best way to inspect a JAR file is. Thirdly, are there functions for inspecting the classes, other than viewmethods? Finally, are there any really useful methods that anyone has found?

    Read the article

  • How to optimize MATLAB loops?

    - by striglia
    I have been working lately on a number of iterative algorithms in MATLAB, and been getting hit hard by MATLAB's performance (or lack thereof) when it comes to loops. I'm aware of the benefit of vectorizing code when possible, but are there any tools for optimization when you need the loop for your algorithm? I am aware of the MEX-file option to write small subroutines in C/C++, although given my algorithms, this can be a very painful option given the data structures required. I mainly use MATLAB for the simplicity and speed of prototyping, so a syntactically complex, statically typed language is not ideal for my situation. Are there any other suggestions? Even other languages (python?) which have relatively painless matrix tools are an option.

    Read the article

  • Growable data structure in MATLAB

    - by rlbond
    I need to create a queue in matlab that holds structs which are very large. I don't know how large this queue will get. Matlab doesn't have linked lists, and I'm worried that repeated allocation and copying is really going to slow down this code which must be run thousands of times. I need some sort of way to use a growable data structure. I've found a couple of entries for linked lists in the matlab help but I can't understand what's going on. Can someone help me with this problem?

    Read the article

  • reading unformatted fortran file in matlab - which precision?

    - by Griff
    I have just written out a file: real*8 :: vol_cel real*8, dimension(256,256,256) :: dense [... some operations] open(unit=8,file=fname,form="unformatted") write(8)dense(:,:,:)/vol_cell close(8) dense and vol_cell are real*8 variables. My code to read this in in Matlab: fid = fopen(fname,'r'); mesh_raw = fread(fid,256*256*256,'double'); fclose(fid); The min and max values clearly show that it is not reading it in correctly (Min is 0 and max is a largish positive real*8). min = 3.3622e+38 max = -3.3661e+38 What precision do I need to set in Matlab to make it read in the unformatted Fortran file? A somewhat related question: This Matlab code I am using reads binary files OK but not unformatted files. Though I am generating this new data on my Mac OSX using gfortran. It doesn't recognize form="binary" so I can't do it that way. Do I need to add some library?

    Read the article

  • Running matlab in the background

    - by msandbot
    Hi, I am running matlab on 48 virtual machines and would like to automate it. I ssh into the machines then use matlab -r matlab_command > outfile.txt & to get the process to run in the background and run fine when I logout. The only problem is that when i jobs my process is stopped and won't start until I fg ^z bg. Is there a matlab flag so that I can run it in the background without having it stop? Thanks, Mike

    Read the article

  • Matlab: Randomize and Split

    - by Null-Hypothesis
    I have following data matrix in Matlab, I am trying to actually split this into multiple segments by passing a variable to a matlab function. But before splitting I would like to shuffle the matrix. The size of my matrix is 150X4 s.data 5.1000 3.5000 1.4000 0.2000 4.9000 3.0000 1.4000 0.2000 4.7000 3.2000 1.3000 0.2000 4.6000 3.1000 1.5000 0.2000 5.0000 3.6000 1.4000 0.2000 .. s = data: [150x4 double] labels: [150x1 double] Coming from R environment I find MatLab is very strange. Initially I thought the columns in matrix has a relationshop like in a R dataframe but thats wrong in my assumption.

    Read the article

  • Breaking from for loop in MATLAB GUI

    - by Nick
    I have a for loop in the opening function of a GUI in MATLAB and I'm trying to use a callback button to break the loop. I'm new to MATLAB. Here's the code I have: %In the opening function of the GUI handles.stop_now = 0; for i=1:inf if handles.stop_now==1 break; end end % Executes on button press function pushbutton_Callback(hObject, eventdata, handles) % hObject handle to end_segmenting_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.stop_now=1; guidata(hObject, handles); For some reason, despite defining the variables with handles, the loop doesn't break upon pressing the button. Anyone know what's going on? Thanks.

    Read the article

  • Expectation values in MATLAB

    - by Bowler
    I have a 3D data set representing a grid of photosensors which unfortunately were not steady during use. I have estimated the pdf for the motion of the detector and I want to find the expectation value for each sensor. As I don't want to reflect my pdf (i.e. I want f(t) not f(t-tau)) I don't think I can use the matlab convolve function. Is there a function that will do what I want. I guess f I've found movavg but it seems to do something else. Also, as I'm faily new to matlab, from C, I tend to use for loops which I'm aware is not the way to use Matlab. Is there an easy way to convert my 1-D pdf to a 3D matrix that will only operate in one axis (z in this case). Something like repmat(i, j, pdf)

    Read the article

  • Out of Memory Matlab Error

    - by Hani
    Dears. I am using Matlab 2009b and having an out of memory error. I read other posted sol but they are not useful for me. I am sure that i am doing things right but i must use very huge amount of array sizes. I think that the problem lies beyond the fact that Matlab does not enable an array to be in more than one OS block. I am using Windows 7. Is there a way to get rid of this problem. For example can i increase the array block that Matlab uses in Windows 7? Thanks...Hani Almousli

    Read the article

  • Open source alternative to MATLAB's fmincon function?

    - by dF
    Is there an open-source alternative to MATLAB's fmincon function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / NumPy / SciPy and this is the only function I haven't found an equivalent to. A NumPy-based solution would be ideal, but any language will do.

    Read the article

  • Launching matlab remotely on windows via ssh? Impossible?

    - by Bob E.
    Howdy, I am trying to run matlab remotely on windows via OpenSSH installed with Cygwin, but launching matlab in windows without the GUI seems to be impossible. If i am logged in locally, I can launch matlab -nodesktop -nodisplay -r script, and matlab will launch up a stripped down GUI and do the command. However, this is impossible to do remotely via ssh, as, matlab needs to display the GUI. Does anyone have any suggestions or work arounds? Thanks, Bob

    Read the article

  • Dynamically add a field to an object in matlab

    - by Marc
    Say I have a MATLAB object defined in a class file classdef foo properties bar end end And I create a foo object myfoo = foo(); Now I want to add another field to foo dynamically. What I want is foo.newfield = 42; but this will throw an error. I know there is a way to dynamically add a field/property to a MATLAB object but I can't remember it or find it easily in the help. Anyone know the syntax?

    Read the article

  • Small eps figure size in Matlab

    - by yCalleecharan
    Hi, How to create a small eps file from a Matlab figure. I use LaTeX and the eps that I'm getting with Matlab (R2010a) is of the order 6 MB. How to set the plot options to give an eps figure of smaller size. Does the render options painters or zbuffer help? Thanks a lot...

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >