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
0answers
11 views

How to add an Excel formula to an entire column using MATLAB

I am trying to summarize an excel sheet and introduce a formula which calculates the value for entire column in excel using matlab. for example: I create this list in excel from matlab: from this ...
0
votes
0answers
10 views

watershed function give wrong output

I want to try wateshed built in fucntion in matlab but the result is diff from my teacher wants , so I change threshold function but it makes worst the images hand turn into grey global img; bw1=...
1
vote
1answer
17 views

How to locate where a built-in function is defined?

In MATLAB, there are roughly 3 ways to define functions: non-comment-only .m files, .p files, and compiled code (e.g. DLL, MEX). Knowing where a function is defined could be helpful in several cases, ...
0
votes
0answers
8 views

Conduct 2x3 repeated measures ANOVA using ranova()

unfortunateley, I do not really understand the ranova function from Matlab. Let`s say I have created the following dummy RESULTS table RESULTS = 20×7 table SUBJ C1_A C1_B ...
0
votes
0answers
7 views

How can I save data Acquired from Kinect V2 Color and Depth Devices Simultaneously?

I Acquired Color and Depth data simultaneously and synchronouusly using software manual triggering : clc; clear; close all; imaqreset colorVid = videoinput('kinect',1); depthVid = videoinput('...
0
votes
1answer
14 views

determine if the file is empty and separate them into different file

The goal of my code is to look into a certain folder and create a new text file with a list of names of all the files that aren't empty in that folder written to a new file, and the list of names of ...
0
votes
1answer
16 views

Use FFT routine in Matlab to find BPM from given ECG

From the assignment: Use the fft routine from MATLAB to find out the beats per minute (BPM) in the myecg.csv file. The sampling period for this signal is 0.00192 seconds and the signal was recorded ...
0
votes
0answers
14 views

How to view or plot a decision tree for the Tree Structure in this example?

I have a code for ID3 decision tree but I cannot find the appropriate code for plotting or viewing the Tree I have used several view MATLAB functions like view(Mdl,'Mode','graph') but none of them ...
0
votes
0answers
32 views

Getting error when using abs() relating to indices

I have the following for loop: for i = 1:3000 disp(DCT(key(i, 1), key(i, 2))); %Apply formula to HL3 in key location i x = sign(DCT(key(i, 1), key(i, 2))); y = abs(DCT(key(i, 1), key(...
1
vote
0answers
9 views

Image Processing Toolbox: how to register a callback for a ROI

I would like to register a callback when a ROI, returned by drawpolygon is clicked. The docs (https://de.mathworks.com/help/images/ref/images.roi.polygon-class.html) say that there is an event ...
0
votes
0answers
5 views

How to fix pyinstaller unable to find matlab files when creating exe file from script

I am attempting to make an EXE from my python script so i can use a GUI on a machine that does not have python installed. Currently my file works well calling a matlab script and sending a JSON object....
0
votes
0answers
13 views

Regular Expression to extract time information from a string in Matlab [duplicate]

Given question is not duplicate as has been marked. Reference using which the question has been marked as duplicate is about the validation of the format. However, I am trying to extract information ...
1
vote
0answers
24 views

How correctly reassign pointer to array Matlab Coder?

I have the following code: add.h: #ifndef ADD_H #define ADD_H void add(double **a, double **b); #endif add.c: #include "add.h" #include <stdlib.h> #include <stdio.h> void add(double ...
0
votes
0answers
22 views

Arithmetic problem with for loop in MATLAB guide

i am new with MATLAB. I would like to use this formula in for loop: ℓ𝑖=taper1*ℓ𝑖−1 There is no error message but i can't see a proper value on output. (i control my values with calculator programs) ...
0
votes
0answers
14 views

Combining Two Images with Matching Features

So basically I am working on trying to combine two images together which overlap each other. I have used the registration estimator app to check and they have matched features. My program at the ...
0
votes
0answers
16 views

How to delete a string in multiple files by using the function eraseBetween (Matlab R2019a)

I am trying without success to delete a specific string (everything between xmln= and the next space) in multiple text files (xml files) by using the Matlab function eraseBetween. The files would then ...
0
votes
1answer
40 views

How can I rewrite this MATLAB code using vectorization?

How can I write this code faster in MATLAB? Maybe using vectorizations. Basically I do not know how to vectorize with if. In the following, if an element of the array u is 0, then the while loop ...
0
votes
0answers
15 views

Comparison of Dynamic Mode Decomposition between Python and Matlab

I am trying to do Exact Dynamic Mode Decomposition (ref: https://arxiv.org/pdf/1312.0041.pdf). I have finished the code in Matlab and it works the way I expect it to work but in Python it does not. I ...
0
votes
0answers
16 views

How to display Matlab variable values in Visual Studio after using Matlab Coder?

I have a very basic Matlab program: hello.m: sprintf('hello') disp("hello") I then convert it to C code using codegen -config:dll hello -report and codegen -config:lib hello -report I then run it ...
0
votes
3answers
42 views

How to fix “Index exceeds the number of array elements (6)”?

I know there're some similar questions around the comunity but I didn't find an answer to understand my problem. I'm writing code to sort a vector without using the sort function. However MATLAB ...
-3
votes
0answers
27 views

How can I exchange data from Matlab to Eclipse? [on hold]

I have a java code written in Eclipse, with the use of cplex, and another one written in Matlab. I want to exchange the data between these two models in an iterative way. How can I do it?
1
vote
1answer
21 views

set Matlab WindowButtonDownFcn and preserve default behavior

can I manually set WindowButtonDownFcn and selectively overwrite the right or middle-click, while preserving default behavior? Ultimate goal would be to copy figure to clipboard on some click. set(...
-1
votes
2answers
33 views

fscanf skips the first line of the file to read

I have a file that I want to read using fscanf. However, the first line gets skipped and I don't understand why. fid2 = fopen('neigh.txt', 'r'); if fid2 < 0 disp('error: file could not be ...
0
votes
0answers
11 views

Matlab fitcsvm function returning converged but with no support vectors

I'm trying to train a two class support vector machine using the matlab command fitcsvm. With identical input data it sometimes returns a usable classifier but most of the time the outputed '...
-1
votes
0answers
25 views

Invalid MEX-file: undefined symbol: fftwf_cleanup [on hold]

Invalid MEX-file '/home/tilakraj/Desktop/code/BPT/BPTTilakraj/NL-SAR-Toolbox/nlsartoolbox_v06/interfaces/mex/sarnlsar.mexa64': /home/tilakraj/Desktop/code/BPT/BPTTilakraj/NL-SAR-Toolbox/...
0
votes
0answers
13 views

How can I incorporate a diagonal transition matrix into the State-Space Model (SSM) framework?

I am using the SSM framework to estimate the yield curve model of Diebold-Li, similar as in https://nl.mathworks.com/help/econ/examples/using-the-kalman-filter-to-estimate-and-forecast-the-diebold-li-...
1
vote
1answer
34 views

Create a vector of enumeration values [on hold]

I have an enumeration class. I wanted to make a list of some of the enumerations, for example, myEnumList = [MyEnum.Hearts; MyEnum.Diamonds]; I get the error, Error using vertcat Dimensions of ...
0
votes
0answers
11 views

How can I train a Chan Vese contour to segment specific tones?

I am using a Chan Vese active contour to segment some of my Ultrasound images. I need to find a way to train this contour segment specific grey tones, without having to threshold the image. I know ...
0
votes
0answers
9 views

Simulating Multivariate GARCH data in MATLAB

I am trying to simulate multivariate GARCH data in MATLAB using Kevin Shepperd's toolbox. The documentation he gives with the code is very light, so I was wondering if someone had some experience ...
0
votes
1answer
18 views

How do I save the funccount from output in fseminf function

I am using fseminf and fmincon functions in my alghoritm. I use it this way [x,fval,exitflag,output,lambda] = fseminf(f,x0,1,@seminfcon1,A,b,Aeq,beq,lb,ub); As an output I get some information: ...
0
votes
0answers
39 views

How to get some objects to move randomly in a space lets say a grid of [-5,5]

I need to move some objects lets say 50 in a space (i.e a grid of [-5,5]) and making sure that if the grid is divided into 100 portions most of the portions (90% or more) are once visited by any ...
1
vote
2answers
43 views

Matlab plot visibility

I'm building a GUI with GUIDE. I want to add a togglebutton to control the visibility of a plot in axes set(handles.axes1,'visible', 'off'); in the button callback but the only thing it does is ...
1
vote
1answer
27 views

Adapting code from one-sided p-values to two sided

I have some code from Rapach, Strauss and Zhou (2013), Journal of finance. It computes bootstrapping p-values for one-sided hypothesis tests, H0: B=0 against H1: B>0 Is it possible for me to ...
0
votes
0answers
34 views

What went wrong during arithmetics calculations in higher dimension matrix in Matlab R2015a

While performing arithmetics calculation below, with higher dimension matrix, it is not returning the result we expected. However, it's working with smaller matrix. The problem with higher dimension ...
0
votes
1answer
26 views

Speedy alternatives to fmincon for log-Likelihood

I am currently using fmincon for minimizing a log-Likelihood function in respect to a 18*18 matrix. While on smaller problems the algorithm is very fast, it takes about 2h to converge in the current ...
0
votes
1answer
39 views

Match each element of one array with elements of other array without loops

I want to match each element of one array (lessnum) with elements of the other array say (cc). Then multiply with a number from the third array (gl). I am doing using loops. The length of arrays are ...
-1
votes
1answer
26 views

How to increase time by 1s and replace old DT_i with the new one

I'm trying to calculate the DT value from a model I set up on Sim4Life. Firstly, i'd like to say that I am a complete beginner and I am trying to understand how programming works in general. Now, I ...
2
votes
3answers
58 views

Matlab method as a property

Is there a way to write a Matlab class that has one of its own methods as a property? I'm writing simulation code in which the class's method (which is effectively a physics equation) might change in ...
2
votes
3answers
42 views

Getting items from a numpy matrix, that indexes are in an array

I'm trying to convert a matlab code into python and I faced a code like : a=[1 2 3;4 5 6;7 8 9] b=[1, 4, 8] a(b) //output : ans : 1 4 8 this actually getting indexes from b and doing a.item(x) ...
-2
votes
0answers
19 views

Can i have a code for dimension reduction algorithm kernel entroy component analysis code for HSI like Inian_pines dataset? [on hold]

I am trying to implement dimension reduction algorithm like KECA(Kernel Entropy Component Analysis) on HSI(Hyperspectral Image i.e: Indian_pines). Is there any code or pseudo code for this algorithm?
1
vote
4answers
51 views

How to tell if a function is built-in or self-defined by its name?

I generate a call graph of a complex MATLAB system, and I want to know which functions are built-in and mark them.
0
votes
0answers
31 views

How to apply a Butterworth Low-Pass Filter in the Frequency Domain and Plot the New Frequency

I'm trying to take a noisy signal, convert it to frequency domain, apply a butterworth low pass filter to it to remove high-frequency noise, then convert it back to the time domain and fit it to a ...
0
votes
0answers
17 views

On doing TSM on audio file, Why do getting an error 'too many output arguments'?

I want to apply TSM (time scale modification) on an audio file and that audio file is already watermarked with an image, and code to do this is given below: Piece of code that calling TSM function ...
0
votes
0answers
13 views

Using CVX in MATLAB and Python support

I was tweaking with CVX Toolbar in MATLAB. I have installed Python3.6 as I realized this is needed by the conelp function. Going into the details, I have realized that the command ``pyversion" on my ...
1
vote
2answers
43 views

How to get array of numbers using ones() in numpy?

Hi I have a code in Matlab which is generating the following sequence. [ones(1,6*2) 2 ones(1,6*2-1) 2 ones(1,6*2) 1] ans = Columns 1 through 18 1 1 1 1 1 1 1 1 1 ...
0
votes
1answer
18 views

what is the fully connected layer in googlent/Resnet50/Resnet101/inception v2 and v3

I'm working on matlab and try to use the pretrained model cited above as feature extractor. In Alexnet and vggnet the fully connected layer is clear which named 'fc7' but in googlenet/resnet50/...
1
vote
0answers
27 views

Matlab - remove white areas

So I am trying to create a panoramic image out of 20 images and have given up trying to use Mathsworks example as I am getting no where. So I deicded to find matching pairs of images manually and then ...
0
votes
0answers
16 views

load and reorganize data with for-loop

I'm setting up a loop to take in some data from my variable RunTrial01,RunTrial02 and RunTrial03. The goal is to reorganize the data so i can compute the average of each trial with different ...
0
votes
0answers
19 views

Opt in the Matlab wrapper for LibRs when configuring CMake

I have this instruction where I want to use a SDK to control a stereo camera with a wrapper in MATLAB. Now I have the instruction: Opt in the Matlab wrapper for LibRs with cmake .. -D... -...
0
votes
1answer
28 views

Magnitude responses of parametric equalizer

I am trying to combine several freqz plots which relates to magnitude responses of parametric equalizer filters in MATLAB. I based my function equalizer on formulas from audio-processing book. The ...

http://mssss.yulina-kosm.ru