Answered

How to find a special numbers among time series data

There might be a more efficient way to do this. But, the code below should work. timesecond = xlsread('time.xlsx'); % reads...

How to find a special numbers among time series data

There might be a more efficient way to do this. But, the code below should work. timesecond = xlsread('time.xlsx'); % reads...

5 years ago | 0

Answered

errors when running file

The function hh doesn't have input. I think MATLAB expect it to have at least one input. You need to change the first line into ...

errors when running file

The function hh doesn't have input. I think MATLAB expect it to have at least one input. You need to change the first line into ...

5 years ago | 0

Answered

Simple For Loop To Find Indices

Are your variables stored as double, or cells? edit: I'm sorry. I made a mistake and I removed the incorrect statement.

Simple For Loop To Find Indices

Are your variables stored as double, or cells? edit: I'm sorry. I made a mistake and I removed the incorrect statement.

5 years ago | 0

Answered

Simple string to number help; how to convert this into a number?

Assuming that H1 contains only one value, you could use n = H1{1} % to access that value in the cell if c <=0 ...

Simple string to number help; how to convert this into a number?

Assuming that H1 contains only one value, you could use n = H1{1} % to access that value in the cell if c <=0 ...

5 years ago | 0

| accepted

Answered

I need to replace an enitre row, if any of the value goes less than zero

This will solve it. a1=[1 2; 3 4; -5 6] a2=[22 23; 56 78; 89 75] neg = a1<0 % return '1' for values le...

I need to replace an enitre row, if any of the value goes less than zero

This will solve it. a1=[1 2; 3 4; -5 6] a2=[22 23; 56 78; 89 75] neg = a1<0 % return '1' for values le...

5 years ago | 1

| accepted

Answered

how to identify rows and columns of a random array with a undetermind amont of rows or colloms

I'm just stating my opinion here. But, do you really need to name the rows and columns as specific variables? Isn't it more effi...

how to identify rows and columns of a random array with a undetermind amont of rows or colloms

I'm just stating my opinion here. But, do you really need to name the rows and columns as specific variables? Isn't it more effi...

6 years ago | 0

| accepted

Answered

listing only the first index

The function |max| alone is sufficient, you don't have to use |find| for this sort of problem. [Y,I] = max(A) The variab...

listing only the first index

The function |max| alone is sufficient, you don't have to use |find| for this sort of problem. [Y,I] = max(A) The variab...

6 years ago | 0

| accepted

Answered

How to add number of cells in a column and not the values in that cells?

V = xlsread('Book1.xlsx'); c = V <= 0; % check the condition ans = sum (c) % count total number of cells

How to add number of cells in a column and not the values in that cells?

V = xlsread('Book1.xlsx'); c = V <= 0; % check the condition ans = sum (c) % count total number of cells

6 years ago | 0

| accepted

Answered

extract first row from matrix

You have the wrong syntax. Lets say A is your 2x5 matrix. A = rand(2,5) Then to extract the first row, you simply use...

extract first row from matrix

You have the wrong syntax. Lets say A is your 2x5 matrix. A = rand(2,5) Then to extract the first row, you simply use...

6 years ago | 6

Answered

how to read specifiied values from xls file?

This happens when you use |fprintf| to save a file in .xls extension. To solve this, use |xlswrite| to write the data into Ex...

how to read specifiied values from xls file?

This happens when you use |fprintf| to save a file in .xls extension. To solve this, use |xlswrite| to write the data into Ex...

6 years ago | 0

| accepted

Answered

How do I solve for two unknowns in this matrix?

This should solve your problem: [A, B] = equationsToMatrix([C, D], [F, G])

How do I solve for two unknowns in this matrix?

This should solve your problem: [A, B] = equationsToMatrix([C, D], [F, G])

6 years ago | 0

| accepted

Answered

read text file into matlab

Use textscan. FID = fopen('iris.txt') C_data0 = textscan(FID,'%f %f %f %f %s', 200, 'Delimiter',',') numericVector = ...

read text file into matlab

Use textscan. FID = fopen('iris.txt') C_data0 = textscan(FID,'%f %f %f %f %s', 200, 'Delimiter',',') numericVector = ...

6 years ago | 0

| accepted

Answered

can xlsread read everything as strings ? if not, are there any other options ?

Have you tried using the command: [~,~,RAW]=xlsread('filename') The variable |raw| will contain everything, if I'm not m...

can xlsread read everything as strings ? if not, are there any other options ?

Have you tried using the command: [~,~,RAW]=xlsread('filename') The variable |raw| will contain everything, if I'm not m...

6 years ago | 1

Answered

Importing and Plotting Data

It's because you have not define the variable |data| .

Importing and Plotting Data

It's because you have not define the variable |data| .

6 years ago | 0

| accepted

Answered

How to remove duplicate NaN values from an X Y data set

There might be more efficient ways to do this, but the following code works. data=[1,2;3,4;nan,nan;5,6;nan,nan;nan,nan;10,1...

How to remove duplicate NaN values from an X Y data set

There might be more efficient ways to do this, but the following code works. data=[1,2;3,4;nan,nan;5,6;nan,nan;nan,nan;10,1...

6 years ago | 1

Answered

How can I remove zero values from the followning label matrix?.

If your matrix is A, then A(A==0) = [] will remove the zeros. But it will change the matrix into a vector. If you wan...

How can I remove zero values from the followning label matrix?.

If your matrix is A, then A(A==0) = [] will remove the zeros. But it will change the matrix into a vector. If you wan...

6 years ago | 2

| accepted

Answered

Help: sort a m by n matrix

Yes, there is a built-in function. c1 = sortrows(c,1)

Help: sort a m by n matrix

Yes, there is a built-in function. c1 = sortrows(c,1)

6 years ago | 0

| accepted

Answered

Simple matlab code issue

B is a 3x3 matrix and C.^2 is a 3x1 matrix. There's no way you can add them. If you want to square matrix C (i.e. C^2), then C h...

Simple matlab code issue

B is a 3x3 matrix and C.^2 is a 3x1 matrix. There's no way you can add them. If you want to square matrix C (i.e. C^2), then C h...

6 years ago | 0

Answered

How to reduce number of entries in legend

I don't really understand the specifics here, but you could choose which plot to display in the legend if you have the handles. ...

How to reduce number of entries in legend

I don't really understand the specifics here, but you could choose which plot to display in the legend if you have the handles. ...

6 years ago | 0

| accepted

Answered

How do I change workspace variable?

var_name = ans; Or in your code, you could've assign a name to it. That way you don't have to manually do it each time.

How do I change workspace variable?

var_name = ans; Or in your code, you could've assign a name to it. That way you don't have to manually do it each time.

6 years ago | 0

Answered

division of uploaded excel file

[Yield,txt,alldata]=xlsread('Book2','Yield'); a=length(txt(1,:)) for i=1:a assignin('base',[txt{i}],Yield(:...

division of uploaded excel file

[Yield,txt,alldata]=xlsread('Book2','Yield'); a=length(txt(1,:)) for i=1:a assignin('base',[txt{i}],Yield(:...

6 years ago | 0

| accepted

Answered

matlab program for getting results of all inputs sets in one column

You have to define n as an input to the function |poster|. I added outer for loop, there might be better ways, but if n is small...

matlab program for getting results of all inputs sets in one column

You have to define n as an input to the function |poster|. I added outer for loop, there might be better ways, but if n is small...

6 years ago | 1

| accepted

Answered

How can I save a series of random numbers i have generated?

r = 100; %number of rows c = 1; %number of columns A = randi(100,r,c); %generate integers between 1 and 100 csvwrite(...

How can I save a series of random numbers i have generated?

r = 100; %number of rows c = 1; %number of columns A = randi(100,r,c); %generate integers between 1 and 100 csvwrite(...

6 years ago | 0

| accepted

Answered

grabbing number after decimal

One way to do this specialNumber = [1234.5; 9087.3]; d = abs(specialNumber - fix(specialNumber)); answer = d*10; %ass...

grabbing number after decimal

One way to do this specialNumber = [1234.5; 9087.3]; d = abs(specialNumber - fix(specialNumber)); answer = d*10; %ass...

6 years ago | 0

Answered

How to make Xaxis (y=0) black in grid

Not sure if this is exactly what you want to do, but instead of making it darker, why not making it thicker? x = [1, 2, 3, ...

How to make Xaxis (y=0) black in grid

Not sure if this is exactly what you want to do, but instead of making it darker, why not making it thicker? x = [1, 2, 3, ...

6 years ago | 1

| accepted

Answered

Not Enough Input Arguments in GA

You have to define the variable x before you run this program. The error "Not Enough Input Arguments" means that MATLAB doesn...

Not Enough Input Arguments in GA

You have to define the variable x before you run this program. The error "Not Enough Input Arguments" means that MATLAB doesn...

6 years ago | 0

Answered

placing values in the form of a triangle in a matrix

If you want it to be a matrix, then I don't think there is a way to do it without adding 0's in the lower part of the triangle. ...

placing values in the form of a triangle in a matrix

If you want it to be a matrix, then I don't think there is a way to do it without adding 0's in the lower part of the triangle. ...

6 years ago | 0

| accepted

Answered

End-of-array value entry

Instead of substituting with i=1:id(end) Use: i=1:length(id) You also might want to preallocate Vd since it chan...

End-of-array value entry

Instead of substituting with i=1:id(end) Use: i=1:length(id) You also might want to preallocate Vd since it chan...

6 years ago | 2

Answered

how to transfer complex results into excel??

Try this. Say A is a vector containing the complex numbers. A = [2+3i;3+i;4-2i]; % example B = num2str(A); C = cel...

how to transfer complex results into excel??

Try this. Say A is a vector containing the complex numbers. A = [2+3i;3+i;4-2i]; % example B = num2str(A); C = cel...

6 years ago | 0

Answered

running a project using genetic algorithm

Try changing the first line in all your files. GAmodule.m should start with: function GAmodule And penalty2.m should...

running a project using genetic algorithm

Try changing the first line in all your files. GAmodule.m should start with: function GAmodule And penalty2.m should...

6 years ago | 0

| accepted