Feeds
已回答
how to sum a vector without sum function
Your idea of using for loop is correct but you should use it to calculate the sum not the mean. If there's a vector A = [1,2,3,...
how to sum a vector without sum function
Your idea of using for loop is correct but you should use it to calculate the sum not the mean. If there's a vector A = [1,2,3,...
6 years 前 | 1
已回答
automatically create a group of same elements from an array
try this, result =mat2cell(sort(A),1, histcounts(findgroups(A))) %A is your array Output is a cell array where you have...
automatically create a group of same elements from an array
try this, result =mat2cell(sort(A),1, histcounts(findgroups(A))) %A is your array Output is a cell array where you have...
6 years 前 | 0
已回答
can anyone help me to change the numbering in y axis to some names, say 'X', 'Y','Z' ?
Just like how you've handled the X-Axis, set(gca,'YTicklabel',{'X','Y','Z'})
can anyone help me to change the numbering in y axis to some names, say 'X', 'Y','Z' ?
Just like how you've handled the X-Axis, set(gca,'YTicklabel',{'X','Y','Z'})
6 years 前 | 0
| 已接受
已回答
I have data in the same excel workbook but in 10 different work sheets and i'm trying to run a loop that will read in the data from each work sheet consectutively.
You could use |xlsread| along with |xlsinfo|. [status,sheets] = xlsfinfo(filename); Now, you have all the sheet names un...
I have data in the same excel workbook but in 10 different work sheets and i'm trying to run a loop that will read in the data from each work sheet consectutively.
You could use |xlsread| along with |xlsinfo|. [status,sheets] = xlsfinfo(filename); Now, you have all the sheet names un...
6 years 前 | 0
| 已接受
已回答
How can I use 'strcat' and 'for loop' to read my Excel data?
There are better ways to handle multiple files in MATLAB. But the main problem in your attempt is that you're not only trying to...
How can I use 'strcat' and 'for loop' to read my Excel data?
There are better ways to handle multiple files in MATLAB. But the main problem in your attempt is that you're not only trying to...
6 years 前 | 1
| 已接受
已回答
Assign matrix to struct
probably you mean something like this g.a(:,1)=[1 2 3 4]'; g.a(:,2)=[1 1 3 4]'; g.a(:,3)=[4 3 1 2]' c=[1 2] b=[...
Assign matrix to struct
probably you mean something like this g.a(:,1)=[1 2 3 4]'; g.a(:,2)=[1 1 3 4]'; g.a(:,3)=[4 3 1 2]' c=[1 2] b=[...
6 years 前 | 0
已回答
How to change cell arrays to 3D arrays in order to speed up calculations?
Convert |x| into a 3d matrix using x_mat = cat(3,x{:}); and then if you want to extract 5th row from all the pages, x...
How to change cell arrays to 3D arrays in order to speed up calculations?
Convert |x| into a 3d matrix using x_mat = cat(3,x{:}); and then if you want to extract 5th row from all the pages, x...
6 years 前 | 0
已回答
how to get the all possible combination between two range of numbers
The example and description is a but confusing but if you ask _how to get the all possible combination between two range of numb...
how to get the all possible combination between two range of numbers
The example and description is a but confusing but if you ask _how to get the all possible combination between two range of numb...
6 years 前 | 0
| 已接受
已回答
cell mean from each cells
It doesn't matter how many lines each cell has. Probably you want something like, C = {rand(50,7),rand(30,7),rand(100,7)}; %...
cell mean from each cells
It doesn't matter how many lines each cell has. Probably you want something like, C = {rand(50,7),rand(30,7),rand(100,7)}; %...
6 years 前 | 0
已回答
Cell array to Matrices
Use 3D matrices, it's a better idea. C_mat = cell2mat(permute(C,[1,3,2]))
Cell array to Matrices
Use 3D matrices, it's a better idea. C_mat = cell2mat(permute(C,[1,3,2]))
6 years 前 | 0
已回答
Can I reference dates, instead of element index numbers, when referencing a time series?
Use the dates to extract the desired indices. Look at the following example, % Create some dummy data t = datetime([2018 1 ...
Can I reference dates, instead of element index numbers, when referencing a time series?
Use the dates to extract the desired indices. Look at the following example, % Create some dummy data t = datetime([2018 1 ...
6 years 前 | 0
| 已接受
已回答
Extracting the data from a column vector according to mod
Instead of creating multiple variables, why not simply reshape your vector into a matrix? x = (1:20); reshape(x,4,[]) an...
Extracting the data from a column vector according to mod
Instead of creating multiple variables, why not simply reshape your vector into a matrix? x = (1:20); reshape(x,4,[]) an...
6 years 前 | 2
已回答
Calculate the mean of two dimensions in a 3D array
If you want the mean of all rows in every page(3rd dimension) mean(ImageROI,1) for columns in every page mean(ImageRO...
Calculate the mean of two dimensions in a 3D array
If you want the mean of all rows in every page(3rd dimension) mean(ImageROI,1) for columns in every page mean(ImageRO...
6 years 前 | 0
已回答
Summing elements of an array
sum([P{:}]) But why would you store it in cell array? If they are all numeric, better use a numeric array.
Summing elements of an array
sum([P{:}]) But why would you store it in cell array? If they are all numeric, better use a numeric array.
6 years 前 | 0
已回答
Adding elements of a matrix
I'm not entirely sure what you want but if you want to calculate mean of all the RGB numbers and have 1x3 result, mean(cell2...
Adding elements of a matrix
I'm not entirely sure what you want but if you want to calculate mean of all the RGB numbers and have 1x3 result, mean(cell2...
6 years 前 | 0
已回答
Loop through a vector with changing legth
why not use a while loop? idx = 1; while idx<=numel(z) %do something z = z(abs(z-z(idx)>=1)); idx = idx+1; ...
Loop through a vector with changing legth
why not use a while loop? idx = 1; while idx<=numel(z) %do something z = z(abs(z-z(idx)>=1)); idx = idx+1; ...
6 years 前 | 0
| 已接受
已回答
how to solve the error "Not enough input arguments."
It's a *function*. You should call it by output = convert2GPS(input) Keep in mind the size of input. link: <https://ww...
how to solve the error "Not enough input arguments."
It's a *function*. You should call it by output = convert2GPS(input) Keep in mind the size of input. link: <https://ww...
6 years 前 | 0
已回答
How to repeat sample data in minutes?
Your variable name looks like you're working with irradiation, in that case I wouldn'r recommend interpolation for your simulati...
How to repeat sample data in minutes?
Your variable name looks like you're working with irradiation, in that case I wouldn'r recommend interpolation for your simulati...
6 years 前 | 1
已回答
Removal of values from cell arrays
If all your arrays have consistent dimension, it's a lot simpler. Not very different from the other answer though, just with cel...
Removal of values from cell arrays
If all your arrays have consistent dimension, it's a lot simpler. Not very different from the other answer though, just with cel...
6 years 前 | 1
已回答
import csv into mate
You're overwriting A everytime. Before you start the loop define A as a cell array, A = cell(numFiles,1) and then inside ...
import csv into mate
You're overwriting A everytime. Before you start the loop define A as a cell array, A = cell(numFiles,1) and then inside ...
6 years 前 | 0
| 已接受
已回答
Add zeros to matrices same as length of another matrix
_can I add zeros to the bold 360x3 matrix to make it 369x3 in one go?_ You say you want to add *9 rows* but you are trying to...
Add zeros to matrices same as length of another matrix
_can I add zeros to the bold 360x3 matrix to make it 369x3 in one go?_ You say you want to add *9 rows* but you are trying to...
6 years 前 | 0
| 已接受
已回答
Read data from file
Something quick, d = readtable('whole res.txt'); d = table2cell(d); d = regexprep(d,' ',''); d = cellfun(@str2do...
Read data from file
Something quick, d = readtable('whole res.txt'); d = table2cell(d); d = regexprep(d,' ',''); d = cellfun(@str2do...
6 years 前 | 0
已回答
Index exceeds matrix dimensions help
There are so many issues. Let's address your error first. Your counter variable |n| is bigger than the size of your |y| vector (...
Index exceeds matrix dimensions help
There are so many issues. Let's address your error first. Your counter variable |n| is bigger than the size of your |y| vector (...
6 years 前 | 0
| 已接受
已回答
How to compare spec limit
Do it with a logical mask, V1 = 0.16; V1_LL = 0.36; V1_UL = 0.66; V1(V1<V1_LL) = V1_LL; V1(V1>V1_UL) = V1_UL;
How to compare spec limit
Do it with a logical mask, V1 = 0.16; V1_LL = 0.36; V1_UL = 0.66; V1(V1<V1_LL) = V1_LL; V1(V1>V1_UL) = V1_UL;
6 years 前 | 0
已回答
how to save every iteration into workspace
You're overwriting alpha during every iteration. Replace |alpha| with |alpha(c)| and then move the save command outside the loop...
how to save every iteration into workspace
You're overwriting alpha during every iteration. Replace |alpha| with |alpha(c)| and then move the save command outside the loop...
6 years 前 | 1
已回答
Entering a vector in a function with if else statement
I'm afraid your usage of |sorted_data(i-1)==NaN| would always return false. The right way to find if a value is nan is to use |i...
Entering a vector in a function with if else statement
I'm afraid your usage of |sorted_data(i-1)==NaN| would always return false. The right way to find if a value is nan is to use |i...
6 years 前 | 0
已回答
Make a function accept vector
This is called the element-wise operation. When you write |x^2|, MATLAB tries to find |x*x| but when you write |x.^2|, it calcul...
Make a function accept vector
This is called the element-wise operation. When you write |x^2|, MATLAB tries to find |x*x| but when you write |x.^2|, it calcul...
6 years 前 | 0
已回答
How do I fill a column and/or row vector with the j-th/i-th sums of a magic matrix' vectors?
If I understand you correctly, you want to make the sum of rows and columns, mag = rand(4); r = sum(mag,1); c = sum(mag,...
How do I fill a column and/or row vector with the j-th/i-th sums of a magic matrix' vectors?
If I understand you correctly, you want to make the sum of rows and columns, mag = rand(4); r = sum(mag,1); c = sum(mag,...
6 years 前 | 0