Answered

how to calculate the average of two values data that side by side and place it between those two values

mn = movmean(A, 2, 'Endpoints','discard'); Result = zeros(1, length(A)+length(mn)); Result(1:2:end) = A; Result(2:2:end) = mn...

how to calculate the average of two values data that side by side and place it between those two values

mn = movmean(A, 2, 'Endpoints','discard'); Result = zeros(1, length(A)+length(mn)); Result(1:2:end) = A; Result(2:2:end) = mn...

environ une heure ago | 0

| accepted

Answered

Error reading through all images in a directory

currentImage = fullfile(imageList(k).folder, imageList(k).name);

Error reading through all images in a directory

currentImage = fullfile(imageList(k).folder, imageList(k).name);

environ une heure ago | 0

| accepted

Answered

Read every netcdf files in a folder

Try this with full path filename folderData = 'D:\Valerio\data\TEST'; filePattern = fullfile(folderData, '*.nc'); ncfiles = ...

Read every netcdf files in a folder

Try this with full path filename folderData = 'D:\Valerio\data\TEST'; filePattern = fullfile(folderData, '*.nc'); ncfiles = ...

environ 3 heures ago | 0

Answered

Find/Match index of variable from an array

zq = find(b == a)

Find/Match index of variable from an array

zq = find(b == a)

environ 5 heures ago | 2

| accepted

Answered

how can I use mean for cell arrays within cell

result = cellfun(@(x)mean(x, 'omitnan'), [T_mon{:}])

how can I use mean for cell arrays within cell

result = cellfun(@(x)mean(x, 'omitnan'), [T_mon{:}])

1 jour ago | 0

Answered

Colormap for multline plot

"A colormap is matrix of values between 0 and 1 that define the colors for graphics objects such as surface, image, and patch ob...

Colormap for multline plot

"A colormap is matrix of values between 0 and 1 that define the colors for graphics objects such as surface, image, and patch ob...

1 jour ago | 0

| accepted

Answered

How do I read in a text file (CREATED FROM BINARY IMAGE OF ROWS-420 AND COLUMNS 680) and sort it by a ROW

x = logical(randi([0,1], 420, 680 )); % assumed that x is your extracted data from the text file x_sorted = sort(x, 2); % s...

How do I read in a text file (CREATED FROM BINARY IMAGE OF ROWS-420 AND COLUMNS 680) and sort it by a ROW

x = logical(randi([0,1], 420, 680 )); % assumed that x is your extracted data from the text file x_sorted = sort(x, 2); % s...

2 jours ago | 0

| accepted

Answered

fid =fopen returns -1 when creating a new file

You forgot the coma fid=fopen('pressure_output.txt','w'); For more details read https://in.mathworks.com/help/matlab/ref/fope...

fid =fopen returns -1 when creating a new file

You forgot the coma fid=fopen('pressure_output.txt','w'); For more details read https://in.mathworks.com/help/matlab/ref/fope...

2 jours ago | 0

| accepted

Answered

Insert a string section on the numbers in a vector

res = arrayfun(@(x)strcat('CH_', num2str(x)), A, 'UniformOutput', false); res{1}, res{2} % to get each element

Insert a string section on the numbers in a vector

res = arrayfun(@(x)strcat('CH_', num2str(x)), A, 'UniformOutput', false); res{1}, res{2} % to get each element

5 jours ago | 0

| accepted

Answered

Expected one output from a curly brace or dot indexing expression, but there were 4 results.

Could you specify, what are you trying to do? The error because of punneeSquare of size 5x5 and you are trying to assign one va...

Expected one output from a curly brace or dot indexing expression, but there were 4 results.

Could you specify, what are you trying to do? The error because of punneeSquare of size 5x5 and you are trying to assign one va...

5 jours ago | 0

Answered

How can I extract values of last three columns in a matrix when second column value is 2?

data = readmatrix('icon.txt'); req_data = data(data(:, 2)== 2, end-2:end); If you are using MATLAB older version than R2019a ...

How can I extract values of last three columns in a matrix when second column value is 2?

data = readmatrix('icon.txt'); req_data = data(data(:, 2)== 2, end-2:end); If you are using MATLAB older version than R2019a ...

5 jours ago | 0

| accepted

Answered

Multiple specific elements in an array

Assuming a, b,c, d, ..g are values in the vector say X X = 1:7; sum([2:4].*[sum(reshape(x(1:6), 2,3))]);

Multiple specific elements in an array

Assuming a, b,c, d, ..g are values in the vector say X X = 1:7; sum([2:4].*[sum(reshape(x(1:6), 2,3))]);

6 jours ago | 1

Answered

writing in excel in loop in matlab

First get the all data (A1, A2, A3...) as one(say A) variable using loops, after loop ending write variable A (whole data) to ex...

writing in excel in loop in matlab

First get the all data (A1, A2, A3...) as one(say A) variable using loops, after loop ending write variable A (whole data) to ex...

6 jours ago | 0

Answered

How to Read and plot CSV file and delete infinity values from CSV file

opt = detectImportOptions('sensor.csv', 'MissingRule', 'fill', 'NumHeaderLines', 2); T = readtable('sensor.csv', op); header =...

How to Read and plot CSV file and delete infinity values from CSV file

opt = detectImportOptions('sensor.csv', 'MissingRule', 'fill', 'NumHeaderLines', 2); T = readtable('sensor.csv', op); header =...

6 jours ago | 0

Answered

How to assign timetable as cell type?

Suppose TT is your timetable variable cell_array = table2cell(timetable2table(TT)); %timetable to cell

How to assign timetable as cell type?

Suppose TT is your timetable variable cell_array = table2cell(timetable2table(TT)); %timetable to cell

7 jours ago | 0

| accepted

Answered

Select values from cell array with condition using cellfun

Res = A(find(~cellfun(@(x)any(x>5 | x<-5, 'all'), A)));

Select values from cell array with condition using cellfun

Res = A(find(~cellfun(@(x)any(x>5 | x<-5, 'all'), A)));

7 jours ago | 0

| accepted

Answered

How do I create a matrix that expands with new column vectors added to it?

% it is recommended to prellocate x before operation but in your case x is not predetermined so assign columns directly n = 5; ...

How do I create a matrix that expands with new column vectors added to it?

% it is recommended to prellocate x before operation but in your case x is not predetermined so assign columns directly n = 5; ...

7 jours ago | 0

| accepted

Answered

How to condense a plot with a shorter x-axis?

Normalize your data t = 1:1000000; % assumed data d = linspace(0, 1, numel(t)); % create vector of length t from 0 to 1 p...

How to condense a plot with a shorter x-axis?

Normalize your data t = 1:1000000; % assumed data d = linspace(0, 1, numel(t)); % create vector of length t from 0 to 1 p...

7 jours ago | 0

Answered

add zero time in timeseries date time column

Suppose dt is date time series, apply dt.Format = 'dd/MM/yyy HH:mm:ss'

add zero time in timeseries date time column

Suppose dt is date time series, apply dt.Format = 'dd/MM/yyy HH:mm:ss'

8 jours ago | 0

| accepted

Answered

Finding matching strings from a table and making a new table

T_1 = T(strcmp(T.A, 'AFG'), :);

Finding matching strings from a table and making a new table

T_1 = T(strcmp(T.A, 'AFG'), :);

8 jours ago | 1

| accepted

Answered

Plotting graph with for-end loop in

%Setting all original variables Em=2.4e9; Ef=76e9; vm=0.34; vf_samll=0.22; theta=30; Vf=0:0.1:1; Ex = zeros(1, length(Vf)...

Plotting graph with for-end loop in

%Setting all original variables Em=2.4e9; Ef=76e9; vm=0.34; vf_samll=0.22; theta=30; Vf=0:0.1:1; Ex = zeros(1, length(Vf)...

8 jours ago | 1

| accepted

Answered

I have a c file written using mex functions, run by Matlab using mex compiler. Now I want to run those mex type .c files without Matlab environment. So, is there any way to convert mex type .c file to normal .c file.

You can convert an apple to juice, but it is like to convert back juice to an apple For more info based MATLAB experts saying ...

I have a c file written using mex functions, run by Matlab using mex compiler. Now I want to run those mex type .c files without Matlab environment. So, is there any way to convert mex type .c file to normal .c file.

You can convert an apple to juice, but it is like to convert back juice to an apple For more info based MATLAB experts saying ...

8 jours ago | 0

| accepted

Answered

How to select certain columns of a matrix only when the values in the 4th row are bigger than three values of the other four rows in that particular column?

mat = abs(your matrix say urmat); ind = mat(4,:)>mat([1:3, 5], :); ind_4 = ind(4,:); desired_col = urmat(:, ind_4); % or m...

How to select certain columns of a matrix only when the values in the 4th row are bigger than three values of the other four rows in that particular column?

mat = abs(your matrix say urmat); ind = mat(4,:)>mat([1:3, 5], :); ind_4 = ind(4,:); desired_col = urmat(:, ind_4); % or m...

8 jours ago | 0

Answered

Accepting multiple inputs in the form of an array

n_entr = 6; low_lim = 1; high_lim = 100; arr = zeros(1, n_entr); c = 1; fl =1; while fl in = input('Enter unique valu...

Accepting multiple inputs in the form of an array

n_entr = 6; low_lim = 1; high_lim = 100; arr = zeros(1, n_entr); c = 1; fl =1; while fl in = input('Enter unique valu...

9 jours ago | 0

Answered

Shift array by one element backwards or forward

x = -5:5; % array fr = circshift(x, 1); % forward bk = circshift(x, -1); % backward

Shift array by one element backwards or forward

x = -5:5; % array fr = circshift(x, 1); % forward bk = circshift(x, -1); % backward

9 jours ago | 1

Answered

Delete rows or column with NaN for a cell array

nan_loc = cellfun(@(x)any(isnan(x)), P_QC, 'UniformOutput', false); for ii=1:length(P_QC) P_QC{ii}(:,nan_loc{ii}) = []; e...

Delete rows or column with NaN for a cell array

nan_loc = cellfun(@(x)any(isnan(x)), P_QC, 'UniformOutput', false); for ii=1:length(P_QC) P_QC{ii}(:,nan_loc{ii}) = []; e...

9 jours ago | 0

| accepted

Answered

Coding a quadratic root finder

You no need to do program to find roots of the quadratic quation, MATLAB has built in command roots a=input('a=') b=input('b='...

Coding a quadratic root finder

You no need to do program to find roots of the quadratic quation, MATLAB has built in command roots a=input('a=') b=input('b='...

9 jours ago | 0

Answered

How to extract data in excel file in matlab

data = readmatrix('2014-2015 KU Basketball.xlsx'); [val, ind] = max(data(:, 2)); game_num = data(ind, 1);

How to extract data in excel file in matlab

data = readmatrix('2014-2015 KU Basketball.xlsx'); [val, ind] = max(data(:, 2)); game_num = data(ind, 1);

9 jours ago | 0

Answered

How to Access and Rename Doubles that are Stored in a Large Cell

You no need to rename every elecment(500x100 double) of the cell which leads much complications, you can perform your operation...

How to Access and Rename Doubles that are Stored in a Large Cell

You no need to rename every elecment(500x100 double) of the cell which leads much complications, you can perform your operation...

9 jours ago | 1