Answered

Trying to change cells in a table

try this: Column1Names={'type_1';'type_2';'type_3';'type_4';'type_5'}; % making another table LastName = {'Sanchez';'Johnson'...

Trying to change cells in a table

try this: Column1Names={'type_1';'type_2';'type_3';'type_4';'type_5'}; % making another table LastName = {'Sanchez';'Johnson'...

5 Monate ago | 0

| accepted

Answered

Compare two columns having different values.

try this: A={'a','b','c','d','e'}; B={'b','c','d','e','f'}; C={'a','-' 'b','b' 'c','c' 'd','d' 'e','e' '-.','f'}; a=[A(...

Compare two columns having different values.

try this: A={'a','b','c','d','e'}; B={'b','c','d','e','f'}; C={'a','-' 'b','b' 'c','c' 'd','d' 'e','e' '-.','f'}; a=[A(...

5 Monate ago | 0

Answered

Labels above bar-plot

please expand the plot for a clear view. A=1:5:200; B=1:40; bar(B) text(1:length(A),B,num2str(B'),'VerticalAlignment','botto...

Labels above bar-plot

please expand the plot for a clear view. A=1:5:200; B=1:40; bar(B) text(1:length(A),B,num2str(B'),'VerticalAlignment','botto...

5 Monate ago | 0

Answered

How to resolve issue while dealing with larger matrices?

A=randi(16,[4,4]); B=A(:)'; P=randi(16,[1 4]); V=randi(16,[1 4]); [C out]=ismember(V,B); if numel(out(out~=0)) ==4 d...

How to resolve issue while dealing with larger matrices?

A=randi(16,[4,4]); B=A(:)'; P=randi(16,[1 4]); V=randi(16,[1 4]); [C out]=ismember(V,B); if numel(out(out~=0)) ==4 d...

5 Monate ago | 1

Answered

how to define matirx series?

square bracket returns horizontal concatenation of input argument. i guess you can use a cell array c = {a1,a2,a3};

how to define matirx series?

square bracket returns horizontal concatenation of input argument. i guess you can use a cell array c = {a1,a2,a3};

5 Monate ago | 0

Answered

How to define a text variable using an older text variable?

x=1:10; T = compose("batch1_%d.csv",x(:))

How to define a text variable using an older text variable?

x=1:10; T = compose("batch1_%d.csv",x(:))

5 Monate ago | 1

Answered

How to replace zeros in a vector with random segments of the same vector?

try this: A=[1 2 3 0 0 0 4 5 0 0 0 0 0 0 0 0 8 9]'; % any matrix B=A(A==0); % extract the number of 0 rdnumber=randi([10 ...

How to replace zeros in a vector with random segments of the same vector?

try this: A=[1 2 3 0 0 0 4 5 0 0 0 0 0 0 0 0 8 9]'; % any matrix B=A(A==0); % extract the number of 0 rdnumber=randi([10 ...

5 Monate ago | 0

Answered

How do I extract column vectors from a cell of doubles array?

A=load('cell_of_doubles.mat'); B=A.cell_of_double_balls ; C=cell(size(B,2),1); for i=1:size(B,2) C{i}=B{1, i}(:,1:3); ...

How do I extract column vectors from a cell of doubles array?

A=load('cell_of_doubles.mat'); B=A.cell_of_double_balls ; C=cell(size(B,2),1); for i=1:size(B,2) C{i}=B{1, i}(:,1:3); ...

5 Monate ago | 0

| accepted

Answered

Delete rows from string array with just one value

as i don't have your data so i have added NaN string to make the same dimension cell array x={'Na','Mg','Si' NaN; 'V' NaN NaN ...

Delete rows from string array with just one value

as i don't have your data so i have added NaN string to make the same dimension cell array x={'Na','Mg','Si' NaN; 'V' NaN NaN ...

5 Monate ago | 0

| accepted

Answered

readtable decide which coloumns are read as string and which as number. xlsx file

i have tried to make your excel and applied readtable function..see the result. A=readtable('example_2.xlsx','ReadVariableName'...

readtable decide which coloumns are read as string and which as number. xlsx file

i have tried to make your excel and applied readtable function..see the result. A=readtable('example_2.xlsx','ReadVariableName'...

5 Monate ago | 0

| accepted

Answered

Why do I receive the error that arrays have incompatible sizes for this operation?

try this: A=input('initial value:'); B=input('number of values:'); C=input('final value:'); % A=2; % B=10; % C=20; D=A:(C...

Why do I receive the error that arrays have incompatible sizes for this operation?

try this: A=input('initial value:'); B=input('number of values:'); C=input('final value:'); % A=2; % B=10; % C=20; D=A:(C...

5 Monate ago | 0

Answered

How to export a large array from workspace to an excel sheet [Ed. so that NaNs are preserved] ?

try this: A=[1 2 3; NaN 3 NaN; 4 NaN 7]; % made a matrix with Nan value B=num2cell(A) B(isnan(A)) ={'NaN'}; % NaN as a stri...

How to export a large array from workspace to an excel sheet [Ed. so that NaNs are preserved] ?

try this: A=[1 2 3; NaN 3 NaN; 4 NaN 7]; % made a matrix with Nan value B=num2cell(A) B(isnan(A)) ={'NaN'}; % NaN as a stri...

5 Monate ago | 0

| accepted

Answered

How can I reshape a square matrix to a rectangular matrix based on its adjacency list?

try this: A =[0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0...

How can I reshape a square matrix to a rectangular matrix based on its adjacency list?

try this: A =[0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0...

5 Monate ago | 3

Answered

how to adjust x-axis in plot

try repmat function: A=[30 2 4 6 8 10]; no_of_rows=1; no_of_repeated_times=3; B=repmat(A,no_of_rows,no_of_repeated_times)

how to adjust x-axis in plot

try repmat function: A=[30 2 4 6 8 10]; no_of_rows=1; no_of_repeated_times=3; B=repmat(A,no_of_rows,no_of_repeated_times)

5 Monate ago | 0

Answered

How to convert row-major linear indices to column-major indices?

try reshape function: A=[1 2 3 4 5 6; 7 8 9 10 11 12;13 14 15 16 17 18] % any matrix D=reshape(A,[],3)

How to convert row-major linear indices to column-major indices?

try reshape function: A=[1 2 3 4 5 6; 7 8 9 10 11 12;13 14 15 16 17 18] % any matrix D=reshape(A,[],3)

5 Monate ago | 0

Answered

How to shuffle rows in pairs?

try this: A=randi([1 8],600,1); for i=1:size(A,1) if A(i)==1 A(i+1)=2; elseif A(i)==3 A(i+1)=4; ...

How to shuffle rows in pairs?

try this: A=randi([1 8],600,1); for i=1:size(A,1) if A(i)==1 A(i+1)=2; elseif A(i)==3 A(i+1)=4; ...

5 Monate ago | 0

Answered

Writing and Executing Formula in Excel by MATLAB

My approach: import the excel file into matlab >> Processing >> export into excel. str={'Matched'}; A=readtable('example.xlsx...

Writing and Executing Formula in Excel by MATLAB

My approach: import the excel file into matlab >> Processing >> export into excel. str={'Matched'}; A=readtable('example.xlsx...

5 Monate ago | 0

Answered

Converting location of a 2x3 vector into a matrix with value 1

if 2nd one is your expecter output , then a = [1 3;2 4;7 8]; Z = zeros(10) ;% 10 x 10 matrix containing only zeros...

Converting location of a 2x3 vector into a matrix with value 1

if 2nd one is your expecter output , then a = [1 3;2 4;7 8]; Z = zeros(10) ;% 10 x 10 matrix containing only zeros...

5 Monate ago | 1

Answered

how to apply if statement with equations

you have only 2 conditions. greater/equal to 0 or less than 0. so try to use if-else function, not if-elseif. Cm2 = [80.105 81....

how to apply if statement with equations

you have only 2 conditions. greater/equal to 0 or less than 0. so try to use if-else function, not if-elseif. Cm2 = [80.105 81....

5 Monate ago | 0

Answered

How to replace the trapped zeros by previous number in a given matrices keeping leading and trailing zeros fixed?

try this: A=[ 0 0 0 1 0 2 3 1 2 3 0 0 0 1 2 2 1 1 2 ...

How to replace the trapped zeros by previous number in a given matrices keeping leading and trailing zeros fixed?

try this: A=[ 0 0 0 1 0 2 3 1 2 3 0 0 0 1 2 2 1 1 2 ...

5 Monate ago | 0

| accepted

Answered

How to use nested loop to produce the row and columns like that

you did not clear your expection. you can try this A = [2,4,8,7,3;2,2,3,4,3;5,5,4,2,7;8,2,7,3,9;1,2,3,4,5]; rows = size(A,1); ...

How to use nested loop to produce the row and columns like that

you did not clear your expection. you can try this A = [2,4,8,7,3;2,2,3,4,3;5,5,4,2,7;8,2,7,3,9;1,2,3,4,5]; rows = size(A,1); ...

5 Monate ago | 0

Answered

How can I take the element of odd rows of an array (n rows, 1 column) and make a variable with all this elements?

you don't need a loop A=(1:20)'; oddrow=A(1:2:end)

How can I take the element of odd rows of an array (n rows, 1 column) and make a variable with all this elements?

you don't need a loop A=(1:20)'; oddrow=A(1:2:end)

5 Monate ago | 0

| accepted

Answered

How to I find x in sin(x) = 0.65

a=sind(30) x=asind(0.5) %Inverse sine in degrees

How to I find x in sin(x) = 0.65

a=sind(30) x=asind(0.5) %Inverse sine in degrees

5 Monate ago | 0

Answered

how to shift trapped zeros to the bottom keeping leading zeros in given matrix fixed?

if your matrix A almost same dimension( 5 X 13) everytime, then A = [0 0 0 1 0 2 3 1 2 3 0 0 0; 1 2 2 1 1 2 3 1 2 3 1 3 4; 0...

how to shift trapped zeros to the bottom keeping leading zeros in given matrix fixed?

if your matrix A almost same dimension( 5 X 13) everytime, then A = [0 0 0 1 0 2 3 1 2 3 0 0 0; 1 2 2 1 1 2 3 1 2 3 1 3 4; 0...

5 Monate ago | 2

Solved

Y=X

Given an input variable x, output a variable y that is equal in value to x. Example: Input x = 1 Output y is 1 Inp...

5 Monate ago

Solved

03 - Matrix Variables 6

Make _fMat_ be a 5x3 matrix of random integers with values from -3 to 3 (Hint: use *randi*)

5 Monate ago

Solved

07 - Common functions and indexing 4

Define the matrix _cMat_: <<http://samle.dk/STTBDP/Assignment1_3c.png>> ( _cMat_ = 10x10 matrix where the numbers from 1 t...

5 Monate ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

5 Monate ago

Solved

Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

5 Monate ago

Answered

How to check if all the data in the cell array are the same?

if you want to find every index for true or false A={100}; B=repmat(A,1,10); [Lia Locb]=ismember(string(B),string({100}))

How to check if all the data in the cell array are the same?

if you want to find every index for true or false A={100}; B=repmat(A,1,10); [Lia Locb]=ismember(string(B),string({100}))

5 Monate ago | 0