# Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. Don’t use both the [matlab] and [octave] tags, unless the question is explicitly about the similarities or differences between the two. When using this tag, please mention the MATLAB release you're working with (e.g. R2017a).

**0**

votes

**0**answers

7 views

### How to match a sub matrix which belongs in a big matrix?

Suppose I have a 128*128 matrix. Also i have a 64*64 matrix. This 64*64 matrix lies in that 128*128 matrix. I want to print "match found" when this 64*64 matrix found in that 128*128 matrix.
...

**0**

votes

**1**answer

12 views

### How could we do temporal filtering for video processing?

I am reading the slides for temporal filtering in Computer vision class and i am wondering how can we do temporal filtering for videos?
For example they say "How could we create a filter that keeps ...

**0**

votes

**0**answers

7 views

### Displaying multiple images in a UIAxes object in Matlab appdesigner

My problem is that I want to display multiple images generated from a for loop into a UIAxes object in matlab app. Ive tried imshow but it changes every loop so in the end it only displays the last ...

**0**

votes

**0**answers

4 views

### Plotting ROC curve in cross validation using Matlab perfcurve

I have the following code for a binary classifying using SVM, and 10 cross-validation,
k=10;
cp = classperf(lables);
cvFolds = crossvalind('Kfold', lables, k);
for i = 1:k ...

**-2**

votes

**0**answers

6 views

### Could you help me in Matlab and MARS algorithm?

I m trying to figure out multivairate additive regression splines and write code in Matlab
I couldnt solve how I find knot points
Thanks for any help

**0**

votes

**0**answers

21 views

### How to solve the problem of matrix multiplication in Matlab

binary operator * not implemented for matrix uint8 matrix operation
I have applied the * as well when I do that I get the error as non conformant argument. I can run it in the command line and it ...

**1**

vote

**1**answer

12 views

### Matlab string concatenation behavior with different data types

I am using Matlab 2018b on Windows 10. I understand that the Matlab string concatenation needs input arguments under concatenation to be a character array, a cell array of character vectors, or a ...

**0**

votes

**1**answer

11 views

### Uploading data from matlab to firebase

firebase creates a name for the data i upload from matlab.
is there a way to cancel this name? or set it to something constant so the next time i upload ill overwrite it?
example:
https://cdn1....

**3**

votes

**1**answer

18 views

### Exporting figures programmatically (R2019a)

In MATLAB R2019a a new way to export figures was added whereby the result "is tightly cropped around the axes with minimal white space". This feature is accessed using the axes toolbar:
My question ...

**0**

votes

**1**answer

10 views

### Divide an image into non-overlapping blocks and applying the 2D DWT on each block

I am working on creating an image splicing detection software so I need to divide the image into non-overlapping blocsk and apply Discrete Meyer Wavelet Transform on each block of the image
I have ...

**0**

votes

**0**answers

26 views

### Resample scattered data points to fit a grid, using interpolation in Matlab

I have 2701 scattered data points (Kx,Ky), and I want to interpolate them to fit a grid. Probably by using griddedInterpolant in Matlab, but I don't understand how the input values work and can't find ...

**-1**

votes

**1**answer

19 views

### cut away the black frame of images using MatLab

For my master thesis I have to examine several similarly structured images with Matlab. I have already coded the actual evaluation. My problem is that the images have a black frame of different ...

**0**

votes

**0**answers

24 views

### Delete rows from a Table when 2 specific columns are both zeros

I'm trying to delete rows of a table, when both values of 2 specific columns are equal to zeros. I've tried to use ismember(col1 & col2, 0),:)=[]; but it deletes the rows when only one of the ...

**0**

votes

**0**answers

9 views

### Zero phase filtering of FIR from filter and Analysis Toolbox

How can i use filtfilt function in the following filter created by matlab filter analysis toolbox.My matlab is 2012.
Below is the syntax but i don't know the variables inside the parentheses y = ...

**-1**

votes

**0**answers

7 views

### Need help in FMCW [on hold]

I'm working on FMCW detecting heart rate an breath, and I get some data from android with a PCM file. I need help to confirm if my method is working well. I see one problem based on the data, the ...

**0**

votes

**0**answers

14 views

### How to translate “spectrogram(x,512,256,512,Fs,'yaxis')” into octave “specgram” function?

I have to create the spectrogram of a signal. The thing is that i am using Octave and the only example i have is with spectrogram function from Matlab.
I have tried to use the simple syntax specgram(...

**0**

votes

**1**answer

18 views

### Filling an area below a curve with a colormap defined by the function of the curve

Consider the following plot:
On the left you can see the fill of a circle with respect to a profile of a function using patch command
t = linspace(-pi,pi,100);
c = exp(-cos(t));
figure(1)
patch(cos(...

**0**

votes

**0**answers

17 views

### How to find the intersection of 2 curves?

I need to calculate the point of intersection of 2 curves.
I tried polyxpoly and another code available online, none of which came handy.

**0**

votes

**1**answer

30 views

### How to output a table in Matlab by altering the function statement?

My technique of making a vector out of "column" variables in a table only works part of the time. What is different about K1 from index in the following code? I am debugging a numerical method and I ...

**2**

votes

**1**answer

39 views

### numpy reshape question (matlab comparison)

Say I have a 1-D vector named s composed of 0,3,6,9.
In MATLAB the shape is denoted (1,4). i.e. a 1x4 row vector.
But in numpy the shape is given as (4,). Why? Shouldn't this notation denote a 4x1 ...

**2**

votes

**2**answers

29 views

### Matlab: use plot and semilogy in same graph (Matlab 2014)

I want to use plot and semilog in the same graph so as to compare results. I get only the one waveform though using hold on function. What can I do ? I cant use yyaxis left cause my matlab is lower ...

**0**

votes

**0**answers

25 views

### Generating a matrix from a matrix with all possible products of elements of a row taken two at a time (combinations)

For example if I have a matrix (1,2,3), I need to generate a matrix (1*2 , 2*3, 1*3) where the number of elements in a row is nC2 where n is the number of elements in a row of the original input ...

**0**

votes

**1**answer

18 views

### Using Surf and Peaks for non square Matrices

Im trying to use meshgrid with peak. When I use square matrices like:
[x,y] = meshgrid(1:10,1:10)
z = peaks(10)
surf(x,y,z)
Everything works fine.
However, when I use Non square matrices:
[x,y] = ...

**0**

votes

**0**answers

30 views

### How to reproduce Python string with Matlab

I'm calling from Matlab a Python script for a chess application. I want to override the input value in the Python script and provide it through Matlab. However, I'm having issues in constructing the ...

**0**

votes

**1**answer

27 views

### How to fix extra space that MATLAB displays after first iteration

I have an fprintf statement which loops 3 times in order to display some data. After the first iteration, MATLAB displays a mysterious space even though I have not added an extra \t. It acts as if I ...

**0**

votes

**0**answers

25 views

### Insert a plot image inside table in MATLAB

I'm very new in MATLAB and I'm trying to do the following: I've 5 images and I want to create a table with names and some statistics as columns. In addition, I would like to insert one column in which ...

**-1**

votes

**0**answers

16 views

### Why my MATLAB code is not solving equation/formula?

I am studying energy and power signals in MATLAB from the book "Signals & systems laboratory with MATLAB". I am trying to implement the example code at top of page 123
syms t T
x=heaviside(t)-...

**-2**

votes

**0**answers

9 views

### Building a cardinal sine function in matlab by starting from the sine function

I have a really specific homework: I have to create a cardinal sine function in matlab by starting from the sine function, but I have really no idea on how to do it. Can someone help me getting the ...

**-1**

votes

**0**answers

29 views

### Why 0.1+..(10 times in total)..+0.1-1 is not zero in Octave?

I know that it is a pretty simple question but I can not find an answer.
So, in Octave when I type
(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)-1
I get this
ans = -1.1102e-16
Can someone explain me ...

**1**

vote

**0**answers

21 views

### How could I rotate in 90 degrees the legend of a plot on Matlab?

I'm creating some plots and I need to rotate in 90 degrees the legend to avoid the overlapping of the legend over the graphic.
I've tried to use the 'Rotation' propriety but I receive the following ...

**0**

votes

**0**answers

10 views

### Make Patch ratio fit 3D plot ratio

Im using a script that was written by Witold Bużantowicz as shown in the link (Specifically speaking about the function called flypath.m)
The code basically draws an object (missile for example) at ...

**0**

votes

**1**answer

23 views

### How can i set a specific and irregular tick on a Matlab axis?

With Open-BCI, i got values (sampled at 255Hz) that i want to plot on matlab. However, i would like specific ticks on the x axis (i think it's the correct term) to match the acquisition protocol. It ...

**0**

votes

**1**answer

18 views

### Variable assigned in NaN in loop iteration

I am trying to calculate Entropy manually and my variable to store the result gets a NaN value at every iteration. I have the following code snippet in a matlab function -
entropy = 0.0;
%Calculating ...

**0**

votes

**1**answer

42 views

### Changing data diagonally in matrix based on formula and table

Let says I have this matrix:
(x)
X = [1 1 1 0 1 0 0 0;
1 1 0 1 0 1 0 0;
1 0 1 1 0 0 ...

**0**

votes

**1**answer

16 views

### Problems reading a .csv file with ezread

I was trying to read a csv file with ezread https://de.mathworks.com/matlabcentral/fileexchange/11026-ezread and I get the following problem:
Error using textscan
The second input must be a ...

**0**

votes

**1**answer

27 views

### How to calculate the accurate execution time in matlab?

I'm working on a stream cipher algorithm with Matlab and i want to see the difference in time with every change i made in Non-linear function. I created a Non-linear function which has some "mod" ...

**-1**

votes

**0**answers

31 views

### How to return std vector output from mex function?

I have a problem regarding how to output a std::vector of booleans from a c++ function to a mex function.
Right now, my code is made of the standard mex function and a function "prox", which stores ...

**0**

votes

**0**answers

16 views

### Finding for what input a function produces a given output

I have been given a file called generator.m that simulates a generatord in 2D. The simultation I have been given is a stripped down version of what can be found here https://www.comsol.se/model/...

**0**

votes

**0**answers

23 views

### Latex listings package cannot include matlab code with percentage symbol

I'm writing a Matlab project report using latex. I use lstinputlisting command in listings package to parse a Matlab code file.
The original Matlab code has following lines.
s = functions(solvers{...

**1**

vote

**1**answer

82 views

### Distance Calculations for Nearest Mean Classifer

Greetins,
How can I calculate how many distance calculations would need to be performed to classify the IRIS dataset using Nearest Mean Classifier.
I know that IRIS dataset has 4 features and every ...

**2**

votes

**0**answers

23 views

### matlab: addition of symbolic matrices along an unused dimension

How can symbolic matrices collected in a cell array be summed along an unused dimension? Assume, for reasons beyond the scope of this post, that the matrices must be the elements of a cell array, ...

**0**

votes

**0**answers

14 views

### Matlab seems to pass arrays of mismatching lengths in integral2 when it should not

Given two parametrized line segments, how does one peform a double integration along them?
Here is what I am trying to do:
p10 = [0,0,0]; %line 1 start
p11 = [1,1,1]; %line 1 end
p20 = [0,1,0]; %...

**1**

vote

**0**answers

21 views

### .NET dll calling in MATLAB

I have a public .dll (KRcc64.dll) created by a manufacturer using .NET for interfacing any code with his machine .
It has a class called "Commu" for making TCP/IP connection with the machine .
...

**0**

votes

**0**answers

13 views

### MATLAB plotting without dynamic / interactive properties? (Intention: speed up plotting)

I do a lot of plotting in MATLAB within nested for loops, so the total plot time adds up significantly, and I'm looking for ways to speed it up. I recently came across a Quora thread, here, which ...

**0**

votes

**1**answer

30 views

### For loop seems to be faster than a matrix operation

I have been working on logits for a while for which I need to use the built-in exp() function. This seems to be running slower for a large matrix compared to using a for loop with smaller chunks of ...

**0**

votes

**0**answers

12 views

### Is there a similar way to define multiple sub-variables within an overall variable in MATLAB, similar to how Python does it? [duplicate]

Within python you can define specific variable names and their values within an overall variable like in the code below. I think this makes defining whole sets of variables that need to be passed into ...

**0**

votes

**0**answers

22 views

### Failing to keep only red channel of RGB image in MATLAB

I'm trying to keep and display only the red channel of an RGB image in MATLAB but I've some problems. I'm using the following code:
red = rgbimage(:,:,1)
black = zeros(size(red, 1), size(red, 2))
...

**0**

votes

**1**answer

21 views

### How can we convert a scattered data into matrix form in matlab? [on hold]

In the k space, we have scattered data which we want to interpolate , can we convert it into matrix form so that it can be interpolated.

**0**

votes

**2**answers

23 views

### Error using images.internal.imageDisplayParsePVPairs in Matlab

I am trying to run this code in order to warp an image, but I can not run that properly on Matlab R2018b and get the following error:
>> captureWarpPoints('man11.jpg');
Error using images....

**0**

votes

**1**answer

10 views

### How to show SVM plot with several features in Matlab

I have 100 samples with 16 features each, and I want to plot the SVM results, but from what I understand that the below code, takes only two columns from X, (two features), is there a way to have the ...