Answered
Optimizing a 'for' loop
Hi, you should do the strcat out of the loop, something like PT12 = strcat(PT{1,1}(:,1), PT{1,2}(:,1)); and then you ...

11 years ago | 1

| accepted

Answered
Matlab function runtime in Simulink
Hi Tim, Simulink does not simulate in Real-Time. So if a step of 1s of simulation time takes 0.01s of computer time or an hou...

11 years ago | 0

| accepted

Answered
Multiple Matlab installations with diferent mex compiler?
Hi Jonas, multiple MATLAB installations do not share the same preferences, but 32/64 bit, that's right. One simple strategy i...

11 years ago | 0

Answered
How to speed up surf plot for thousands of objects ?
Hi, parfor won't work, because the figure you plot to is bound to the MATLAB desktop you work on. You can transfer computatio...

11 years ago | 0

Answered
Need to get rid of an eval and loop
Hi, to start with, I would suggest to do a data_i = eval(sprintf('data%d', i)); at the very beginning of the i-loop a...

11 years ago | 0

Answered
Saving a matlab figure file without displaying it
Hi, you might open the figure invible: f = figure('visible', 'off'); surf(peaks); print -djpeg test.jpg close(f) I...

11 years ago | 6

| accepted

Answered
Run one function only once when the function starts everyday or some time period
Hi, you mean something like this: function Data() l = login(); code of data processing....etc function aLogin =...

11 years ago | 1

Answered
Using DLL functions with parfeval
Hi Alexander, using loadlibrary will load the dll only to the client MATLAB, not to the pool workers. You will need to do this ...

11 years ago | 1

| accepted

Answered
export a jar file from MATLAB
Hi, MATLAB is MATLAB, .jar is Java. There is no "export of a jar file". But there is a product called MATLAB Builder JA (see ...

11 years ago | 0

Answered
co-existing matlab compilers
Yes. Multiple MCR versions on one machine are no problem. The compiled application always looks for the exact match, regardless ...

11 years ago | 0

Answered
Hold plot for several different cases
Hi, the simplest would be to add after the plot command: plot(handles.plot,x,y,'DisplayName',name,'Color',color); hol...

11 years ago | 0

Answered
mex folder with all elements
Hi, not really. You can add all files of one folder by /my documents/*.cpp but that doesn't include sub folders. You ...

11 years ago | 1

Answered
Pass parameters to simulink executable
Hi Stefano, you pass the parameters as .mat file via command line parameter to the executable. How to do this is described in...

11 years ago | 0

Answered
MATLAB deploytool not working, fails while building.
Hi Ivan, did you change the version of the JDK? You don't have to use the exact same, just the same major version. So if your...

11 years ago | 0

Answered
Problem with factorial recursive function
Hi Arun, your code does not work for arrays because of the "if n<=1". You would need to do something like idx = (n>1); ...

11 years ago | 1

Answered
Code optimization (3 line function)
Hi, one thing that comes to my mind: can you swap rows and columns, i.e., transpose your input matrix? function Y = refl...

11 years ago | 1

Answered
How can I write all month's last dates for a given period of time?
Hi, first of all: you don't need the loop BigMatrix = b + (1:a); BigMatrixStr = cellstr(datestr(BigMatrix)); For the...

11 years ago | 1

| accepted

Answered
How to convert distinct strings in a cell array to numbers.
Hi, something like this: x = {'Loc' 'Buf' 'Cac' 'Loc' 'Cac' 'Buf' 'Buf' 'D'} [C,~,ib] = unique(x); % the unique s...

11 years ago | 1

Solved


Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

11 years ago

Answered
Class using static method causes clear warning
Hi Hakan, instead of a static method you could use a constant property. BTW, what version of MATLAB do you use? I remember th...

11 years ago | 0

| accepted

Answered
Using mex variable_name; where variable_name contains filename to be compiled
Another way of doing this is similar to other functions, that are often used this way as save, load, etc. Use the functional for...

11 years ago | 0

Answered
how to find mean from cell
Hi, first of all, why do you convert the matrix to a cell? Why not call mean for M? It should give you the mean for all colum...

11 years ago | 0

Answered
C++ shared library compiling/packaging errors
Hi, I'm not sure, but I could imagine it's the name "main". In C/C++ the main function has a special meaning (and a special s...

11 years ago | 1

| accepted

Answered
Optimization Of Function, Curve Fitting
Hi Mike, if you have the Optimization Toolbox available, take a look at the function doc lsqcurvefit It is exactly fo...

11 years ago | 0

Answered
I did not find in the documentation. What is the meaning of set(0,....). What does 0 signify?
Hi, the 0 is the root of the graphics system. It contains information like screen resolution: get(0) CallbackO...

11 years ago | 0

Answered
How to Add a Header file(#include"*.h") from simulink ?
Hi, under the code generation pane for the Simulink Configuration there is the entry "Custom Code". Here you can add you head...

11 years ago | 2

| accepted

Answered
MCR v7.16 Problem
Hi, you will need to install the correct MCR on "the other" computer. You find the MCRInstaller in your R2011b installation u...

11 years ago | 0

Answered
Matlab Coder / Compiler and Classes
Hi David, leaving the speedup aspect aside another option would be to use MATLAB Compiler and MATLAB Builder NE <http://www.m...

11 years ago | 0

| accepted

Answered
Attempt to reference field of non-structure array.
Hi, please use the code button to format your code. I assume the error happens at the line rowa=scana.data(:,end); Ta...

11 years ago | 0

Answered
Cpp file in Matlab
Hi, you will need to tell mex where to find the include files, and probably also the library files. Your call should look som...

11 years ago | 0

| accepted

Load more