Questions tagged [matlab]

24400 questions
-1

votes
2

answer
2k

Views

Find index of a pair of value in array with matlab

I've 2 values and I would like to find them in a array. This values have the same index Example: 0 0 1 2 2 3 4 5 I'm looking for (1,2) so the index is 2
user2724407
1

votes
2

answer
705

Views

fast way to convert datetime to string

I want to know if there is faster way to convert a datetime to a string besides datestr. datetime is inserted every other lines in my main function (including all of its dependency). I need time at that line of code is executed. I think my only option is to convert datetime to string faster....
Kane
0

votes
0

answer
2

Views

Comparing the result of LSTM and a deep neural network

Can I use sequenceInputLayer(n_features) when applying deep neural net and NOT LSTM model in Matlab? I applied LSTM on time-series data in Matlab 2018b. Now, I want to show that considering temporal relationships in LSTM improves performance. To do that, I need to apply a deep neural net with the sa...
user9439906
1

votes
1

answer
1.2k

Views

Python 2.7: Area opening and closing binary image in Python not so accurate

I am using Python 2.7 and I used following Python and Matlab function for removing noises and fill holes in this image . 1. Code to remove noise and fill holes using Python and Opencv img = cv2.imread("binar.png",0) kernel = np.ones((5,5),np.uint8) open = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel...
Naseeb Gill
1

votes
3

answer
1.4k

Views

Plotting sin(x)/(x) in Matlab

I am having issues plotting sin(x)/(x) correctly. Specifically when x = 0, returns NaN in Matlab. However, when applying L'Hôpital's rule the actual value is y = 1. My question is how can I go into the y matrix and change the of NaN. What I brainstormed for possible approaches is creating a For loo...
Delta117
1

votes
1

answer
152

Views

How to plot bars reversed up with negative values?

Starting by this 10x3 y matrix, where all its entries are negative values: y = [-56 -58 -60; -75 -74 -72; -66 -66 -69; -67 -69 -71; -66 -67 -71; -59 -58 -57; -69 -71 -69; -59 -58 -58; -66 -67 -68; -75 -73 -72]; I need to plot it simply using bar(y), but the ba...
Mohsen Ali
1

votes
2

answer
902

Views

Converting python Dataframe to Matlab file

I am trying to convert a python Dataframe to a Matlab (.mat) file. I initially have a txt (EEG signal) that I import using panda.read_csv: MyDataFrame = pd.read_csv("data.txt",sep=';',decimal='.'), data.txt being a 2D array with labels. This creates a dataframe which looks like this. In order to con...
Nono
1

votes
2

answer
248

Views

Plotting confidence intervals in Matlab

I am having trouble plotting confidence intervals through errorbar function inside Matlab. I have written the following code below clear all; close all; %CH15 Program for Chapter 15 % % Monte Carlo for a European call randn('state',100) %%%%%%%%%%%%%%%%% Problem and method parameters %%%%%%%%...
Axion004
1

votes
1

answer
29

Views

Storing p values using Econometrics toolbox in matlab

This code will run with the econometrics toolbox, model = arima('Constant',0.5,'AR',{0.9999},'Variance',.4); rng('default') Y = simulate(model,50); figure plot(Y) xlim([0,50]) title('Simulated AR(1) Process') rng('default') Y = simulate(model,50,'NumPaths',1000); Y1=Y(:,1); for ii = 1:50 Mdl = arim...
Tony Chivers
1

votes
1

answer
35

Views

Dymola-Simulink interface

I'm trying to create a compound model of Matlab and Dymola. Therefore I followed this tutorial: Claytex tutorial Instead of the DrivenPendulum model, I made a simple model myself. I can translate the model in Dymola just fine, and the Compilation of the Dymola model in Matlab works like in the tutor...
Giovanni Bay
1

votes
1

answer
20

Views

MATLAB: Replace column in cell array with NaN

I have a 3x2 cell array data where each cell contains a double matrix. It looks something like this: {600x4 double} {600x4x3 double} {600x4 double} {600x4x3 double} {600x4 double} {600x4x3 double} Now, I would like to replace the second column of the cell array with NaNs. The result should therefore...
Andi
1

votes
1

answer
32

Views

How to decrease MATLAB Runtime compiler size to make a stand alone application?

I just want to make an exe file in MATLAb to make a stand-alone application, after some research on the internet I found this link on the MATLAB website and download MATLAB Runtime compile and made my application. It makes me a exe file but the problem is that if you want to run your code on another...
motevalizadeh
1

votes
1

answer
37

Views

How to change a still plot to a movie in Matlab?

I am trying to understand how Movie in Matlab works, I have never used it before. I have a code for the heat equation that finds temperature for the amount of segments I decide to put on the length of the object (rod). I am able to plot a normal plot that shows all the values at different conditions...
James
1

votes
1

answer
39

Views

Applying threshold to an image

I am trying to write a function that thresholds a grey-level image F and a threshold value t (0 ≤ t ≤ 255) such that r = 0 for r < t and r = 255 otherwise. I have tried to implement this, but imshow(r) does not produce an output. function f = imgThreshold(img, t) f = img; if (f < t) f = 0; else...
CObject
0

votes
0

answer
3

Views

calling matlab .m function in IDL Unix

I was trying to use some build-in matlab function in my IDL program. On windows I can do that with the using COM Objects in IDL: oMatlab = obj_new('IDLcomIDispatch$ProgID$Matlab_application') My question is that is there any interface like COM object available in Unix? I couldn't find any so far. O...
colddie
0

votes
0

answer
2

Views

Improving scatter plot in Matlab

I have to do the scatter plot of a 2-dimensional region in Matlab. The collection of the points (x,y) that should be included in the scatter is obtained by running a computationally intense code. As a result, this is the scatter that I get I don't like the picture because in principle there should...
user3285148
0

votes
0

answer
6

Views

error 'too many inputs arguments' with rowfun

Why doesn't this anonymous function work with rowfun? >> T = table([43;52;67;28],[64;24;69;45]) >> rowfun(@(x) sum(x), T) Error using tabular/rowfun>dfltErrHandler (line 497) Applying the function '@(x)sum(x)' to the 1st row of A generated the following error: Too many input arguments. I know that r...
HappyPy
0

votes
0

answer
4

Views

Matlab - Path to Function File calling a Function File

I have a function f0.m which calls a function f1.m. Inside f1.m I am needing to know the path of the caller function f0.m. mfilename('fullpath') and S=dbstack('-completenames'); S(1).file gives the current file f1.m and matlab.desktop.editor.getActiveFilename gives the Active file in the editor (wh...
Brethlosze
1

votes
3

answer
67

Views

Count occurrence of array elements

Well I have an array called A: [8 2 6 1 6 1 6 1 1 2] How to count the occurrence of the same rows? It does not work well with unique because it does not differentiate between the rows.
MikiBelavista
1

votes
1

answer
1.2k

Views

python loading several matlab files

I was wondering of how I can load several matlab files in python. I am very new to python and don't know much I am using scipy.io.loadmat('/~/20130228_100000_3D_E=1.mat') and then I save the data in .vts format How can I do this with all the available matlab files I have by running my program only o...
aregak
1

votes
2

answer
1.2k

Views

Solving ODE with Simulink in Matlab

I need to solve this ODE using Simulink and I don't know how to make it. I only know how to do it using ODE solvers. y'' - y' - 2y = e^(3x) y(0)=1, y'(0)=2. I rewrote the equation obtaining an ODEs: y' = f(x,y) y(x0) = y0 y'1 = y2 y2= e^(3*x) + y' + 2y Using ODE solver. If someone can help me to so...
jorreto
1

votes
2

answer
1.4k

Views

How To Label Colormaps in MATLAB?

I have the following image derived from imagesc(some matrix whose entries correspond to those colors). The Cyan and the Yellow both mean different things. I would like to either: Add a legend where I can fill in what each color means Segregate parts of the X-axis to where I can type "cyan" on the x...
Alvin Nunez
1

votes
1

answer
910

Views

Optional input arguments on Matlab function

I need to implement a function that does some image processing on a specific number of images (nFrames) that are located in a folder (folder1). The function would look something like: function imgProc( nFrames,path ) Let's say I have several folders with different numbers of images in each one. What...
Marta Sampietro
1

votes
2

answer
1.6k

Views

Matlab Questions about Audioplayer GUI

I am quite new to Matlab and I am trying to make a program where there are 3 push buttons. Question 1: Button 1 will be linked to an audio file (.wav) So when I press it, Button 1 will "select" the first audio file. Button 2 will be linked to another audio file (.wav) So when I press it, Button 2 wi...
user4514279
1

votes
2

answer
64

Views

Access columns of a table having the same prefix

I need to select all the columns of a MATLAB table whose name starts with 'data'. The table is formatted as follows: sub. | age | gender | ... | ... | data1 | data2 | data3 | ... | data4 | ... | Is there a way to do so? Something like selected_table = table.data*
gabboshow
1

votes
2

answer
582

Views

Scale image object to match another object's scale

I have two sets of images of different size for each set. The first set is images of 400x400 pixels with real picture objects. The second set is 319x319, with image silhouettes of different scale than the real picture objects. What I want to achieve, is basically to have the silhouettes replaced by...
kalfasyan
1

votes
1

answer
1.3k

Views

How to choose value of k in RELIEFF Algorithm in MATLAB

I'm using relieff algorithm to investigate the ranking of various inputs for solving a classification problem. I have five inputs and about 500 observations. I'm using MATLAB to solve this. I start off by setting the k nearest neighbors for the algorithm to 2 and vary it all the way till 450. The ra...
Alok Shenoy
1

votes
1

answer
383

Views

Bring Matlab uigetfile window to front of all other programs?

I'm calling a script from another program (Vicon Nexus 2.3). This other program will launch Matlab, then run the script. The first thing the script does is it calls uigetfile(). However since the Nexus program has the Windows focus, the uigetfile() window appears behind everything. Is there any way...
willpower2727
1

votes
1

answer
226

Views

How to transform different shapes to circles in Matlab

I have this image: that has different shapes, and I want to transform each shape in a circle. And each circle must have different radius, depending on the size of the shape. How can I do that? With Morphology Operations or there are any function on Matlab that does that? I used the function Region...
Pedro Marques
1

votes
1

answer
230

Views

Using a vector as an input for a function of multiple inputs in matlab

I want to use a vector input such of dimension [m;1] in a function that takes in m number of inputs. For example: syms x1 x2; f = x1^2 + x2^2; F = matlabFunction(f); x = [1;1]; F(x); The above code does not work because F is a function of 2 inputs and it only sees the vector x as a single input. I k...
ktobrien
1

votes
2

answer
1.7k

Views

Calculate the percentage in Matlab

I want to calculate the percentage of accuracy. I have the code below. But it give unexpected output like this "The accuracy is 2.843137e+01x37". While expected result is "The accuracy is 28.43%" y %Amount of correct data j %Amount of all data a = 'The accuracy is %dx%d.'; percent = '%.0f%%'; format...
Ana Ain
1

votes
1

answer
6.7k

Views

What is the simplest python code to plot a simple graph (simpler than matlab)

If I want to draw a y=x^2 graph from 0 to 9 in matlab, I can do a = [0:1:10] b = a.^2 plot(a,b) Using python, I can do the same like below import matplotlib.pyplot as plt import numpy as np a=[x for x in xrange(10)] b=np.square(a) plt.plot(a,b) plt.show() But to the contrary to my belief that pyth...
Chan Kim
1

votes
1

answer
470

Views

SOX or other method to trim silence in wav without cutting into audio

I need to run a script that processes recorded wav files in this way: 1) Identifies markers in the file (beginning and end) where silence is detected 2) Adds +.2 seconds of audio to these points (-.2 seconds at the beginning and .2 at the end for example) 3) Then trims these points. This is to auto...
user2860668
1

votes
2

answer
204

Views

containers.Map doesn't work with numeric keys

I have the following problem with a containers.Map object in Matlab. Creating a simple object with numeric keys and values: m = containers.Map(1:3,2:4); >> m(1) ans = 2 Works as expected, but >> m(1:2) Error using containers.Map/subsref Specified key type does not match the type expected for this co...
user1618022
1

votes
1

answer
428

Views

What does 3 dot means( … ) in matlab?? [duplicate]

This question already has an answer here: what does ellipsis mean in a Matlab function's argument list? 1 answer What is the meaning of … in some MATLAB codes? [duplicate] 2 answers I am new in matlab. Can someone please tell me from below code what does that 3 dot ( ... ) means?? defaults = st...
Dominic
1

votes
1

answer
131

Views

Average filter without built-in function

I am having a problem with the output. I am using 5*5 filter for making image smooth. As average filter smooth our image but this one is making the image more dull. Can anyone help me with this problem? Input Image is: img_2 = imread('White-Bars.png'); filter = ones(5 , 5)/25; working_img = img_2(:,...
blu.
1

votes
2

answer
100

Views

How do I downsample a signal using Octave?

I have been trying to downsample a signal, but I'm not sure if I have the proper command? can you give me the proper command with a brief explanation?
1

votes
2

answer
65

Views

How to use “ButtonDownFcn” in a populated GUI axes?

I have a very simple GUI made in guide where i have a plot function initiated by a pushbutton which plots a scatter plot in axes (called Method1axes1): handles.plot = scatter(X,Y, 'parent', handles.Method1axes1); Now I want the user to be able to click the axes (plot) to get en new larger figure. I...
Birch78
1

votes
1

answer
54

Views

How to write an equation on the ylabel of a figure in MATLAB?

I'm trying to write the following math on the ylabel of a figure in MATLAB, \norm{\boldsymbol{\tilde{y}}(t)}_2 I've tried this, ylabel('\norm\boldmath{\bf{$y$}}$(t)$', 'interpreter', 'latex'); But got the following error, Warning: Error updating Text. Character vector must have valid interpreter syn...
Mohammad
1

votes
1

answer
40

Views

'cdfread' not reading .cdf file Matlab

I am not able to read '.cdf' files using Matlab cdfread function. I have also tried netcdf The file 'mvn_lpw_l2_lpnt_20180814_v03_r02.cdf' is available here: CDF file I am using Matlab R2015a (release 8.5). Any help please.
Mushi

View additional questions

Смотреть фильмы онлайн бабушка легкого поведения 2 фильм бесплатно