MATLAB enthusiastic

Answered

another way to break without using the command 'break'

You can set a flag variable to terminate while loop without using break keyword term_while = true; % flag variable c = 0...

another way to break without using the command 'break'

You can set a flag variable to terminate while loop without using break keyword term_while = true; % flag variable c = 0...

1 jour ago | 0

Answered

Given a table, how can I delete rows not satisfying a certain property?

Assuming t is your table variable and variable names are col_1 and col_2, cond = (35>t.col_1 & t.col_1<40)&(20>t.col_2 & t.col_...

Given a table, how can I delete rows not satisfying a certain property?

Assuming t is your table variable and variable names are col_1 and col_2, cond = (35>t.col_1 & t.col_1<40)&(20>t.col_2 & t.col_...

2 jours ago | 0

| accepted

Answered

For Looping to import .mat files

procfiles = dir('D:\Leuven_Visit\Workflow\Matlab\Results\HV_NL\*.mat');% cd is not recommended for iMat= 1:size(procfiles, 1) ...

For Looping to import .mat files

procfiles = dir('D:\Leuven_Visit\Workflow\Matlab\Results\HV_NL\*.mat');% cd is not recommended for iMat= 1:size(procfiles, 1) ...

3 jours ago | 0

Answered

Delete rows and columns with zeros in a multi level cell array matrix.

fun = @(in)in(~cellfun(@(x)[strcmp(x,'0')||isempty(x)] , in)); result = cellfun(fun, datafi2 , 'UniformOutput', false);

Delete rows and columns with zeros in a multi level cell array matrix.

fun = @(in)in(~cellfun(@(x)[strcmp(x,'0')||isempty(x)] , in)); result = cellfun(fun, datafi2 , 'UniformOutput', false);

3 jours ago | 0

| accepted

Answered

How to extract data in text file

No need of specifying format(%s) there, MATLAB takes automatically respective data type data = readtable('Ge single crystal tra...

How to extract data in text file

No need of specifying format(%s) there, MATLAB takes automatically respective data type data = readtable('Ge single crystal tra...

4 jours ago | 0

| accepted

Answered

How to make statements intersect

n=3; % length of the your vector i guess a=[0 1 2]; b=[1 1 3]; % depends on n value is_intersect = sum(a(1:n)==b(1:n))=...

How to make statements intersect

n=3; % length of the your vector i guess a=[0 1 2]; b=[1 1 3]; % depends on n value is_intersect = sum(a(1:n)==b(1:n))=...

5 jours ago | 1

Answered

How to arrange misplaced data elements

Read your excel data as T = readtable('< your excel file>'); % your file read in table data Reinitialte the header to ge...

How to arrange misplaced data elements

Read your excel data as T = readtable('< your excel file>'); % your file read in table data Reinitialte the header to ge...

5 jours ago | 0

Answered

Save the table to a specific folder

table_path_format = [save_table '\T.xlsx']; % you forget to put accurate path that is \ operator % or correct way is to use fu...

Save the table to a specific folder

table_path_format = [save_table '\T.xlsx']; % you forget to put accurate path that is \ operator % or correct way is to use fu...

6 jours ago | 1

Answered

Setting the range of colormap

caxis([min(data(:)), max(data(:))]); See more details https://in.mathworks.com/help/matlab/ref/caxis.html

Setting the range of colormap

caxis([min(data(:)), max(data(:))]); See more details https://in.mathworks.com/help/matlab/ref/caxis.html

6 jours ago | 0

Answered

how to add new column in existing text file?

for ii = 1:12000 filename = [num2str(ii), '.txt']; % your file names as 1, 2.. .txt mat = readmatrix(filename); ...

how to add new column in existing text file?

for ii = 1:12000 filename = [num2str(ii), '.txt']; % your file names as 1, 2.. .txt mat = readmatrix(filename); ...

6 jours ago | 0

| accepted

Answered

Matrix Division - Why am I getting a 1x1 matrix after dividing two 1x13 matrices?

You have used operatot "/". Here you need to perform elemtwise operation "./" and ".^" A = 0.000036:0.000001:0.000048 ; %Die Ar...

Matrix Division - Why am I getting a 1x1 matrix after dividing two 1x13 matrices?

You have used operatot "/". Here you need to perform elemtwise operation "./" and ".^" A = 0.000036:0.000001:0.000048 ; %Die Ar...

6 jours ago | 1

Answered

deep learning toolbox: how to change precision to double?

MATLAB is by default double precision floating point(double) i.e. 64-bit. This answer can help you

deep learning toolbox: how to change precision to double?

MATLAB is by default double precision floating point(double) i.e. 64-bit. This answer can help you

6 jours ago | 0

Answered

declaring a new table

After your opeartion, you can apply T3 = struct2table(T3); % converts from struct to table [r, c] = size(T3); % to fin...

declaring a new table

After your opeartion, you can apply T3 = struct2table(T3); % converts from struct to table [r, c] = size(T3); % to fin...

6 jours ago | 0

Answered

How can i access elements in large array in matlab?

Cannot display summaries of variables with more than 524288 elements but You can can access with the index values see for more ...

How can i access elements in large array in matlab?

Cannot display summaries of variables with more than 524288 elements but You can can access with the index values see for more ...

6 jours ago | 0

Answered

Seperate Matlab data for my text file

Suppose your data in the variable data data_in_time = datetime(num2str(data(:,1)), 'Format', 'yyyyMM'); data_in_time.Format = ...

Seperate Matlab data for my text file

Suppose your data in the variable data data_in_time = datetime(num2str(data(:,1)), 'Format', 'yyyyMM'); data_in_time.Format = ...

6 jours ago | 0

Answered

How to convert datenum to datetime in a MATLAB Table

Suppose T is your table variable T.Dates_1 = datetime(T.Dates_1, 'ConvertFrom', 'datenum'); T.Dates_2 = datetime(T.Dates_2, 'C...

How to convert datenum to datetime in a MATLAB Table

Suppose T is your table variable T.Dates_1 = datetime(T.Dates_1, 'ConvertFrom', 'datenum'); T.Dates_2 = datetime(T.Dates_2, 'C...

6 jours ago | 0

Answered

How to mark the beginning and the end of a peak?

Peak Analysis can help you !!

How to mark the beginning and the end of a peak?

Peak Analysis can help you !!

12 jours ago | 1

Answered

any output on command window

Probably all statements of your code terminated with the operator ;(semilocon) that means MATLAB doesnot show the computed resul...

any output on command window

Probably all statements of your code terminated with the operator ;(semilocon) that means MATLAB doesnot show the computed resul...

12 jours ago | 0

Answered

Conversion of C++ code to matlab code

You have not used loop iteration varibales in C++ code?, anyway the plane conversion of your code is % using namespace std; %...

Conversion of C++ code to matlab code

You have not used loop iteration varibales in C++ code?, anyway the plane conversion of your code is % using namespace std; %...

13 jours ago | 2

Answered

Random Sampling of Cell Array Variables which are not necessarily numeric

result = Answer{randi([1, 4])};

Random Sampling of Cell Array Variables which are not necessarily numeric

result = Answer{randi([1, 4])};

13 jours ago | 0

Answered

How to filter data by date?

Suppose your timetable data in the variable td spring = td(timerange('2010-04-01', '2010-05-31'), :); % spring time data summ...

How to filter data by date?

Suppose your timetable data in the variable td spring = td(timerange('2010-04-01', '2010-05-31'), :); % spring time data summ...

13 jours ago | 2

| accepted

Answered

sloution for my question

f = [20, 80, 120]; % your frequencies fs = 100; % sampling frequency t = 0:1/fs:1-1/fs; % time A = 1; % amplitud...

sloution for my question

f = [20, 80, 120]; % your frequencies fs = 100; % sampling frequency t = 0:1/fs:1-1/fs; % time A = 1; % amplitud...

13 jours ago | 0

| accepted

Answered

Plotting data as points onto a previously generated graph

x = [ 233.0000 0.2200 253.0000 1.0571 257.0000 1.8943 237.0000 2.7057 229.0000 3.5171 242.0000 4.3286 2...

Plotting data as points onto a previously generated graph

x = [ 233.0000 0.2200 253.0000 1.0571 257.0000 1.8943 237.0000 2.7057 229.0000 3.5171 242.0000 4.3286 2...

13 jours ago | 0

| accepted

Answered

How can I plot cosine/sine wave with exponential function?

Fs = 10000; % samples persecond t = (0:1/Fs:1-(1/Fs)); % seconds A = 1/2; % amplitude y = -A*cos(t)+A*exp(-t)+A*t.*exp(-t); ...

How can I plot cosine/sine wave with exponential function?

Fs = 10000; % samples persecond t = (0:1/Fs:1-(1/Fs)); % seconds A = 1/2; % amplitude y = -A*cos(t)+A*exp(-t)+A*t.*exp(-t); ...

16 jours ago | 0

Answered

How to read multiple images from multiple folders and display them together?

selpath = uigetdir; % or selpath = '<your directory full path>'; n_images = 100; % number of images for ii = 1:n_images ...

How to read multiple images from multiple folders and display them together?

selpath = uigetdir; % or selpath = '<your directory full path>'; n_images = 100; % number of images for ii = 1:n_images ...

18 jours ago | 0

| accepted

Solved

Alternate list of elements

Write a function that combines two lists by alternating the elements, e.g. ['a','b','c'], ['1','2','3'] → 'a1b2c3'.

18 jours ago

Answered

How to scan text file?

data = readtable('yourfile.txt', 'Delimiter', ',',... 'HeaderLines', 0, 'ReadVariableNames',false, 'Format', '%d');

How to scan text file?

data = readtable('yourfile.txt', 'Delimiter', ',',... 'HeaderLines', 0, 'ReadVariableNames',false, 'Format', '%d');

18 jours ago | 0

Answered

Find the maximum value in different vectors and from which vector is it?

max_val = max([v1, v2,v3]); % or max_val = max([v1(:);v2(:);v3(:)]); v1 = v1 == max_val; v2 = v2 == max_val; v3 = v3 == max_v...

Find the maximum value in different vectors and from which vector is it?

max_val = max([v1, v2,v3]); % or max_val = max([v1(:);v2(:);v3(:)]); v1 = v1 == max_val; v2 = v2 == max_val; v3 = v3 == max_v...

19 jours ago | 1

| accepted

Answered

conversion from double to cell is not possible

I don't know what you are trying to do with given code, if I assume by name of the mentioned function name "sparse to matrix con...

conversion from double to cell is not possible

I don't know what you are trying to do with given code, if I assume by name of the mentioned function name "sparse to matrix con...

21 jours ago | 0