Answered
combining different csv files from a folder into one matrix
csvfiles = dir('*.csv') ; iwant = zeros(1554,801) ; for i = 1:length(csvfiles) data = csvread(csvfiles(i).name) ; ...

7 years ago | 0

Answered
Delete rows in cell arrays
load CellBdS.mat ; s = rawPortData{1}.INDX_MWEIGHT_HIST ; s = s{1} ; c1 = s(:,1) ; % delete first row c1(1) = [] ; % a...

7 years ago | 1

| accepted

Answered
Simple Monte Carlo Taking Too Long
Don't print the result in workspace. Terminate the output using ; Initialize the arrays which are getting filled in loop. i...

7 years ago | 0

| accepted

Answered
How can i extract and store colums from my data
data = importdata('data.txt') ; id = data(:,1) ; [c,ia,ib] = unique(id) ; N = length(c) ; iwant = cell(N,1) ; for i ...

7 years ago | 0

| accepted

Answered
3d Animation of a point
[num,txt,raw] = xlsread(myfile) ; x = num(:,1) ; y = num(:,2) ; z = num(:,3) ; comet3(x,y,z)

7 years ago | 0

| accepted

Answered
Merging Multiple text files
txtfiles = dir('*.txt') ; ncfile = 'myfile.nc' ; N = length(txtfiles) ; nx = 455 ; ny = 455 ; % number of lat, lon for ...

7 years ago | 1

| accepted

Answered
Why is subtracting different sized matrices not giving me an error? What is matlab calculating?
What you are doing is not correct. Note that fft_x - sxx will be a matrix of size 1000X3328. It will subtract the respective ...

7 years ago | 0

Answered
Plotting Latitude, Longitude and a variable
[num,txt,raw] = xlsread('sample_data.xlsx') ; lat = num(:,1) ; lon = num(:,2) ; z = num(:,3) ; z(z>500) = NaN ; s...

7 years ago | 1

| accepted

Answered
Reading in an Entire Video
vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv'); numFrames = 0; iwant = cell([],1) ; while hasFram...

7 years ago | 0

Answered
how to interpolate 2d curves together in 3d
Read about griddata.

7 years ago | 0

Answered
Index of point in matlab plot
x = rand(10,3); y = rand(10,3); hold on plot3(x(:,1),x(:,2),x(:,3),'R.') plot3(y(:,1),y(:,2),y(:,3),'B.') idx = knnsear...

7 years ago | 0

Answered
Index of individual points of two data set in matlab plot
Read about knnsearch to get the indices of multiple points.

7 years ago | 0

Answered
How to set ranges for 2 different variables in the same loop?
while ((x < 40) && (x > 15) && (y < 25) && (y > 5)) deltaLdeltax = ((-(40 - x))/sqrt(((40-x)^2)+((y-10)^2)))+((x-15)/sqrt((...

7 years ago | 0

Answered
Tell me when count of occurrences in a rolling 7-day range exceeds a certain value.
T = readtable('data.txt') ; S = T.(2) ; on = contains(S,'ON') ; off = contains(S,'OFF') ; % Count ON A = on' ; ii = z...

7 years ago | 0

Answered
Problems with an integral
alpha1 = 1.8; kappa1 = 25; alpha2 = 2.2; kappa2 = 27; syms x z; f = alpha1 * alpha2 * kappa1 * kappa2 * (x-z)^(kappa1-1)...

7 years ago | 1

| accepted

Answered
Can I add units to the table?
It is not allowed...may be you can use something like this: varNames = {'Name', 'Age_in_Years'} ; varTypes = {'string','do...

7 years ago | 0

Answered
How to store output for each input.
inputNames = {"mat1.mat", "mat2.mat", "mat3.mat"} length(inputNames) for i = 1:length(inputNames) load(inputNames{i}) ...

7 years ago | 0

Answered
Split a matrix into separate matrices and find centroid of each smaller matrix
A = rand(50,2) ; k = 10 ; [r,c] = size(A); nlay = r/k ; out = permute(reshape(A',[c,r/nlay,nlay]),[2,1,3]); % Ge...

7 years ago | 1

| accepted

Answered
Linear Regression, line of best fit
Read about polyfit https://in.mathworks.com/help/matlab/ref/polyfit.html To fit a line use n=1.

7 years ago | 1

Answered
Creation of 3X3 window
REad this https://in.mathworks.com/matlabcentral/answers/362262-i-have-a-32-32-matrix-i-want-to-take-mean-of-each-4-4-so-that-th...

7 years ago | 0

Answered
How to avoid inf value while feature extracting in Matlab?
Fill this inf's either using fillgaps or fillmissing. REad about those functions. Or, remove them getting the indices of inf usi...

7 years ago | 0

| accepted

Answered
Read large dat file without intermediate text lines
As the number of text lines are fixed i.e 5. We can take advantage of this. We can skip the text lines and read the numeric data...

7 years ago | 0

Answered
How to plot graph using data from a text file?
Replace y/x in the text file with NaN. A = load('sound.txt') ; x = A(1,2:end) ; y = A(2:end,1) ; Z = A(2:end,2:end) ; ...

7 years ago | 2

| accepted

Answered
How to read a part of txt file using readtable(''myfile.txt")
Read about textscan. Here you can specify the header lines........get the position of your line fromw hich you want to read........

7 years ago | 0

Answered
How plot contour lines in matlab
Read about contour3. https://in.mathworks.com/help/matlab/ref/contour3.html

7 years ago | 0

| accepted

Answered
I want to generate random point with Six closest nebulous in cuboid with dimension 100 m
% Random point O = rand(1,3) ; % Six random points with in cubiod of 100 m L = 100 ; n = 6 ; P = zeros(n,3) ; for i = 1...

7 years ago | 0

| accepted

Answered
placing 3 image pixels in an array from a large image vector
YOu know ths sub-indices (i,j) for the required pixels. Get the index for it and arrange in a vector. idx = sub2ind(size(I),...

7 years ago | 0

| accepted

Answered
4D plot in Matlab
[X,Y,Z] = peaks(100) ; surf(X,Y,Z,Z)

7 years ago | 0

Answered
How to find pixels of one cluster that are enclosed by pixels of another cluster?
What you need to use is boundary and inpolygon. You need not to scan through every column. Check the below code. I = imread(...

7 years ago | 0

Answered
How to draw a histogram with different bin colors based on value?
v = [-2, 3, 1, 2, -1, -2] ; x = 1:length(v) ; figure hold on bar(x(v<0),v(v<0),'r') bar(x(v>0),v(v>0),'b')

7 years ago | 1

| accepted

Load more