Answered

How to run script without MATLAB asking to press any key to continue

Remove pause MATLAB commad from your script

How to run script without MATLAB asking to press any key to continue

Remove pause MATLAB commad from your script

28 days ago | 0

Answered

How would i extract ONLY even numbered elements of an image?

Part ii % for even values even_values = imgroup1(mod(imgroup1, 2) == 0); % for display purpose evens = imgroup1.*uint8(mod(i...

How would i extract ONLY even numbered elements of an image?

Part ii % for even values even_values = imgroup1(mod(imgroup1, 2) == 0); % for display purpose evens = imgroup1.*uint8(mod(i...

28 days ago | 0

| accepted

Answered

how to get/extract x,y values from scatter function

You need to apply thresholding to the 3rd column of the x variable upto blue colour as it is normalized colour. If you apply co...

how to get/extract x,y values from scatter function

You need to apply thresholding to the 3rd column of the x variable upto blue colour as it is normalized colour. If you apply co...

28 days ago | 1

| accepted

Answered

How to save indices of a certain region of a matrix

ind = find(ismember(A(:), B(:)))

How to save indices of a certain region of a matrix

ind = find(ismember(A(:), B(:)))

30 days ago | 1

Answered

how to extract one variable elements from a function

[~, ~, E]=GenEllResidue(a,b,n); For more details read https://in.mathworks.com/help/matlab/matlab_prog/ignore-function-inputs...

how to extract one variable elements from a function

[~, ~, E]=GenEllResidue(a,b,n); For more details read https://in.mathworks.com/help/matlab/matlab_prog/ignore-function-inputs...

30 days ago | 0

| accepted

Answered

Renames a lot of files in directory

fileTo = sprintf('Flight 1000%d.mat',kk);

Renames a lot of files in directory

fileTo = sprintf('Flight 1000%d.mat',kk);

30 days ago | 0

Answered

Convert cell array into array

result = cellfun(@vertcat, vertcat(your_array{:}))

Convert cell array into array

result = cellfun(@vertcat, vertcat(your_array{:}))

1 month ago | 0

| accepted

Answered

How to save data from every file in a folder

It is not recommended to create table in loop, get the data in variable(say cell data) then form table out of the loop folderDa...

How to save data from every file in a folder

It is not recommended to create table in loop, get the data in variable(say cell data) then form table out of the loop folderDa...

1 month ago | 0

| accepted

Answered

Simplest way to save a vector to a variable with commas and braces

You can't save the variable data like that but you can store as in string format a = '[1, 2, 3, 4, 5]' save matfile a load ma...

Simplest way to save a vector to a variable with commas and braces

You can't save the variable data like that but you can store as in string format a = '[1, 2, 3, 4, 5]' save matfile a load ma...

1 month ago | 0

Answered

How to filter winter months

Do you mean to get the time values between 1 to 4 and 10 to 12 (winter )? if yes x = 1:12; data = x(x >= 1 & x <= 4 | x>9 & x<...

How to filter winter months

Do you mean to get the time values between 1 to 4 and 10 to 12 (winter )? if yes x = 1:12; data = x(x >= 1 & x <= 4 | x>9 & x<...

1 month ago | 0

| accepted

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...

1 month 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);

1 month 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 = ...

1 month ago | 0

| 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 month 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 month 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...

1 month 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...

1 month 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

1 month 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...

1 month 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 ...

1 month 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))]);

1 month 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...

1 month 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 =...

1 month 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

1 month 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)));

1 month 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; ...

1 month 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...

1 month ago | 0