Answered

How do i write this script in anonymous function

Hi Jaeyoung, as Alex said you probably don't need anonymous function for this script and it won't make the code much shorter. Bu...

How do i write this script in anonymous function

Hi Jaeyoung, as Alex said you probably don't need anonymous function for this script and it won't make the code much shorter. Bu...

1 year ago | 0

Answered

For end loop for acceleration

I don't know why you want to write the code with for loop but this might work. time = yourTime; dt = diff(time) v = yourSpe...

For end loop for acceleration

I don't know why you want to write the code with for loop but this might work. time = yourTime; dt = diff(time) v = yourSpe...

1 year ago | 0

Answered

Help me to sort out this problem.

No_of_Load_Hours = 4; No_of_Units = numel(Input_Vector)/No_of_Load_Hours; Input_Discharges = reshape(Input_Vector,No_of_Load_H...

Help me to sort out this problem.

No_of_Load_Hours = 4; No_of_Units = numel(Input_Vector)/No_of_Load_Hours; Input_Discharges = reshape(Input_Vector,No_of_Load_H...

1 year ago | 0

Question

Is there a way to extract the name of a field of a struct as string

Hi all, lets say I have this struct 'str50' and this struct consists of 3 fields and their names are V10, V100, V1000. I want to...

1 year ago | 1 answer | 0

Answered

How it works regionprops function?

Type, edit regionprops to the command window, so you can analyze what's going on inside.

How it works regionprops function?

Type, edit regionprops to the command window, so you can analyze what's going on inside.

1 year ago | 0

Answered

How to read single value from csv file?

Hi Shritesh, I don't think that you can read strings with csvread. But you can use importdata for this values = importdata('Te...

How to read single value from csv file?

Hi Shritesh, I don't think that you can read strings with csvread. But you can use importdata for this values = importdata('Te...

1 year ago | 0

| accepted

Answered

How to save matlab coding output data in a file?

You can save them in matfiles https://www.mathworks.com/help/matlab/ref/matfile.html

How to save matlab coding output data in a file?

You can save them in matfiles https://www.mathworks.com/help/matlab/ref/matfile.html

1 year ago | 0

| accepted

Answered

4 Day temperature comparison, including current day

You can try to use the last minute of the current day, since it says starting date must be before than ending date todayDate = ...

4 Day temperature comparison, including current day

You can try to use the last minute of the current day, since it says starting date must be before than ending date todayDate = ...

1 year ago | 1

| accepted

Answered

explain computation of P2(1:L/2+1)

It takes one more element than half of it. Let's say your array is P2 = [1 2 5 6 7 8 9]; L = length(P2); P2(1:L/2+1) the ou...

explain computation of P2(1:L/2+1)

It takes one more element than half of it. Let's say your array is P2 = [1 2 5 6 7 8 9]; L = length(P2); P2(1:L/2+1) the ou...

1 year ago | 2

Answered

inverse matrix from result question

Hi pablolama, you can use this for inverse of the each 2*2 matrix. In your code, you aren't storing the new J values. So, you wo...

inverse matrix from result question

Hi pablolama, you can use this for inverse of the each 2*2 matrix. In your code, you aren't storing the new J values. So, you wo...

1 year ago | 1

Answered

how to get random value from normal distribution mean zero standard deviation 1

normrnd(0,1) or randn(5,1)% 5 is just an example it will create 5*1 matrix adjust the value

how to get random value from normal distribution mean zero standard deviation 1

normrnd(0,1) or randn(5,1)% 5 is just an example it will create 5*1 matrix adjust the value

1 year ago | 0

Answered

delete rows in a cell array

Lets say your cell array's variable name is 'a' a = a(all(cellfun(@(x)x~=0,a),2),:);

delete rows in a cell array

Lets say your cell array's variable name is 'a' a = a(all(cellfun(@(x)x~=0,a),2),:);

1 year ago | 0

Answered

read cell array and split into one cell array of multiple rows

name{1,:} = {'A B C D E F G ...

read cell array and split into one cell array of multiple rows

name{1,:} = {'A B C D E F G ...

1 year ago | 0

Answered

Reshape an array into another

a = [1 2 3 4 5 6 7 8;... 9 10 11 12 13 14 15 16;... 17 18 19 20 21 22 23 24;... 25 26 27 28 2...

Reshape an array into another

a = [1 2 3 4 5 6 7 8;... 9 10 11 12 13 14 15 16;... 17 18 19 20 21 22 23 24;... 25 26 27 28 2...

1 year ago | 0

| accepted

Answered

How to do a quick division between a column array and a matrix?

Hi Benson, try this % b = randi(25,25,1); % A = randi(25,25,5); [row,col] = find(abs(A(:,:))>0); dividCol = bsxfun(@rdivide,...

How to do a quick division between a column array and a matrix?

Hi Benson, try this % b = randi(25,25,1); % A = randi(25,25,5); [row,col] = find(abs(A(:,:))>0); dividCol = bsxfun(@rdivide,...

1 year ago | 0

| accepted

Answered

How do I convert a file name into a string

Filename = 'MyFile_12-25-2018.xls' name = strsplit(Filename, '_'); name = string(name{1,2});

How do I convert a file name into a string

Filename = 'MyFile_12-25-2018.xls' name = strsplit(Filename, '_'); name = string(name{1,2});

1 year ago | 1

| accepted

Answered

Why my doesn't work well?

Since you are reading images(from somewhere) it takes uint8 type of variables and for uint8 you can have maximum 255, if you wan...

Why my doesn't work well?

Since you are reading images(from somewhere) it takes uint8 type of variables and for uint8 you can have maximum 255, if you wan...

1 year ago | 0

| accepted

Answered

Finding an average of sample point in an array with irregular intervals

Hi Pavel, you may try this Av2 = cell(4,4); % I2 = rand(20,20,20); for i = 1:4 for j = 1:4 Av2{i,j}...

Finding an average of sample point in an array with irregular intervals

Hi Pavel, you may try this Av2 = cell(4,4); % I2 = rand(20,20,20); for i = 1:4 for j = 1:4 Av2{i,j}...

1 year ago | 0

Answered

Replacing NaNs with zero in a matrix within a cell array.

% a = cell(13,1); % %initializing the values % for i = 1:length(a) % a{i} = nan(63,63); % end %removing the nans for k =...

Replacing NaNs with zero in a matrix within a cell array.

% a = cell(13,1); % %initializing the values % for i = 1:length(a) % a{i} = nan(63,63); % end %removing the nans for k =...

1 year ago | 0

Answered

How to set maximum and minimum limit of signal in MATLAB code.

Hi Usman, you can use one of the codes below. However, I recommend the first one, because no loop is necessary here. x1Max = 3...

How to set maximum and minimum limit of signal in MATLAB code.

Hi Usman, you can use one of the codes below. However, I recommend the first one, because no loop is necessary here. x1Max = 3...

1 year ago | 0

| accepted

Question

I want to call the fifth column from a table

Hi all, I want to call the columns from a table dynamically cellCol ={'column_1' ,'column_2', 'column_3','column_4', 'column_5...

1 year ago | 2 answers | 0

Answered

I am getting an error as "Operands to the || and && operators must be convertible to logical scalar values. Error in xd (line 8) if (t>=t1)&&(t<t2)".

You cannot compare a vector t (which is 1x51 double) with a single value for an if statement, with the logical operators. Even i...

I am getting an error as "Operands to the || and && operators must be convertible to logical scalar values. Error in xd (line 8) if (t>=t1)&&(t<t2)".

You cannot compare a vector t (which is 1x51 double) with a single value for an if statement, with the logical operators. Even i...

1 year ago | 0

| accepted

Answered

imtranslate command matlab shows me a black image

It would be much better if you shared your image. Anyway, probably imtranslate doesn't return black image, the blackness comes f...

imtranslate command matlab shows me a black image

It would be much better if you shared your image. Anyway, probably imtranslate doesn't return black image, the blackness comes f...

1 year ago | 0

| accepted

Question

fprintf for 6 array in double type and 2 date vectors

Hi All, I want to use fprintf for 6 double arrays and 2 date vectors. The dates will be at the first and second column and dou...

1 year ago | 1 answer | 0

Question

Reading Columns with dlmread

Hi all, I want to read third column of a csvfile. In the page of dlmread, it is quite confusing. I didn't understand how to ...

1 year ago | 1 answer | 0

Question

I want to write daily datum into xls file without overwriting

Hi All, I have a daily results of some events, which I update them every day and save the previous values as well. Here, I don't...

1 year ago | 1 answer | 0

Answered

Update problems: unexpected end of file error message/Download image processing toolbox

I think you should give writing permission to its directory. Firstly, you have to find where your matlab is located, so write "m...

Update problems: unexpected end of file error message/Download image processing toolbox

I think you should give writing permission to its directory. Firstly, you have to find where your matlab is located, so write "m...

1 year ago | 0

Answered

how to filling a matrix

Hi dahkli, try this result = eye(180); for i = 1:numel(result) temp = rand>(0.25*mod(i,3)); result(i) = te...

how to filling a matrix

Hi dahkli, try this result = eye(180); for i = 1:numel(result) temp = rand>(0.25*mod(i,3)); result(i) = te...

1 year ago | 0

Question

Reordering variables in a table array

Let's say I have the table below. I want to reorder them by their ages. I tried to use TSort.Age = sort(TSort.Age) but it do...

1 year ago | 1 answer | 0