matlab

matlab reshape function, number of elements problem

Hey guys. I want to use reshape() function in matlab by calling the following self-defined function : imgRgb = reshape(convertYuvToRgb(reshape(imgYuv, height*width, 3)), height, width, 3); here, width=352, height=288, imgYuv is a 4D matrix. However, the system gave me the following error message: To RESHAPE the number of elements must...

Gaussian Basis Function

Can you please tell me how can I model a Gaussian Basis Function in a 2 Dimensional Space in order to obtain a scalar output? I know how to apply this with a scalar input, but I don't understand how should I apply it to a 2 dimensional vector input. I've seen many variations of this that I am confused. ...

The mcc compiler "Depfun error" when building dll with .NET-dependencies and Enumerations That Encapsulate Data

Hi! I ran into problems in MATLAB R2010b when creating a DLL that uses .NET-integration and enumerations with encapsulate data. Example: There is a .NET Assembly which is used in MATLAB, let's call it "MyAssembly" (MyAssembly.dll). There Matlab Enumerations Class "OpenMode" classdef OpenMode methods function obj = OpenMo...

Is it possible to plot two errorbars on one figure?

I need to plot two data vectors with errorbars on one figure. errorbar() function does it, but only for one data set. Is there a way to plot second graph on the same figure? ...

Force MATLAB mmreader or avireader to use a different codec?

How do I force MATLAB functions to use a different codec when I need to play an AVI file? I am using windows7 and I find that indeo5 codec is not working properly because of the OS. All code works fine on XP. Thanks! ...

How to store data from MATLAB to Access DB?

I want to store my results from neural network in MATLAB to Access database, and also store video with it to the same database. For other time when everyone result the same pic from neural network the output for him is video that was stored before in DB... Can you help me? ...

basic FFT normalization questions

Hi Experts, I'm using Matlab to take FFTs of signals, and I'm getting stuck on the normalization. Specifically, how to normalize the spectrum into units of dBm. I know that 0.316228 is the correct normalization factor, but my questions are related to how to normalize the bins correctly. I created the following program to raise my ques...

Can you end a MATLAB program from inside a GUI?

I have a program that I am running that uses video and the only way to stop it(right now) once it starts is to press Ctl+C. My file contains a GUI which displays the live video feed and then a filtered version of it in the same GUI. I can add a close button to the gui with: "uicontrol('String', 'Close', 'Callback', 'close(gcf)');" Th...

How to utilise parallel processing in Matlab

I am working on a time series based calculation. Each iteration of the calculation is independent. Could anyone share some tips / online primers on using utilising parallel processing in Matlab? How can this be specified inside the actual code? ...

matlab cell2mat( ... ) function with cell array having a bunch of sparse matrices overflows memory unexpectedly

I get strange behavior with respect to memory with Matlab and the cell2mat() function... what I would like to do is: cell_array_outer = cell(1,N) parfor k = 1:N cell_array_inner = cell(1,M); for i = 1:M A = do_some_math_and_return_a_sparse_matrix( ); cell_array_inner{i} = sparse(A); % do sparse() again just to be parano...

representing the day and some parameters of a month

Hello, Could you please help me for this matter? I have 3 matrices, P (Power), T (Temperature) and H (Humidity) every matrix has 31 columns (days) and there are 24 rows for every column which are the data for the March of year 2000, i.e. for example, the matrix P has 31 columns where every column represents a day data for Power t...

How can I convert an RGB image to grayscale but keep one color?

So I am trying to create an effect similar to Sin City or other movies where they remove all colors except one from an image. I have an RGB image which I want to convert to grayscale but I want to keep one color. This is my picture: I want to keep the red color. The rest should be grayscale. This is what my code outputs so far (yo...

Matrices extracting and assigning numbers or symbols

Hi, I have huge data matrices stored in a MATLAB M-file and I will explain my problem by this sample example: I have three constant matrices (every matrix has its own values and these values are not changed, they are values for experiment results) Every matrix always has 4 rows and 6 columns The last column of the 1st matrix is a z...