답변 있음
change values in a matrix
For numerical arrays use *REM* and *ABS*. An example: a = [0.1234 -1.9876 -2.0001] b = abs(rem(a,1)) % [0.1234 0.9876...

대략 12년 전 | 0

답변 있음
Find at least 4 consecutive values less than 1 in an array
Here is a relatively simple one-liner: M = [1 0 .3 .5 .2 .1 6 7 .3 .5 10 1 .8 .9 .7 .2 .1 .3] % example data [startIDX, ...

대략 12년 전 | 0

답변 있음
Why is this script so slow and how can i make it faster?
First, when you use loops, try to pre-allocate the outcome N = 1000 ; p = zeros(N,1) ; % pre-allocation for k=1:N ...

대략 12년 전 | 0

답변 있음
How does normr work?
You can open the m-file (type norm.m) and find something like this: [mr,mc]=size(m); if (mc == 1) n = m ./ abs(m); ...

대략 12년 전 | 0

| 수락됨

답변 있음
how Can I move matlab student version 6.5 release 13 to a new computer before the old one dies?
If you have a valid install disk it should have come with an installation code. Simply install 6.5 onto the new computer using t...

대략 12년 전 | 0

답변 있음
Extract length of data in a structure
Still no need for a conversion: a(1).b=ones(4,8); a(2).b=ones(8,1); a(3).b=ones(3,2); a(4).b=ones(7,1); ...

대략 12년 전 | 1

| 수락됨

답변 있음
its not taking the values of y when y value is ranging from 0.25 to 0.45 with an interval of 0.05,but it is able to take the value when y value is constant. and its coming in some matrix but with constant values.
In your assignment ud(i+1,1)=y; the left hand expression "ud(i+1,1)" is a single element, whereas the right hand express...

대략 12년 전 | 0

| 수락됨

답변 있음
Extract length of data in a structure
No need for conversion to cell array. Use <http://www.mathworks.nl/help/matlab/ref/structfun.html STRUCTFUN> on the structure di...

대략 12년 전 | 0

답변 있음
How to remove dependent rows in a matrix?
Another, very straightforward, approach is to include them one by one and observe the changes in rank … (I agree that this is no...

대략 12년 전 | 1

답변 있음
Creating a polynomial data set
Take a look at POLYFIT and POLYVAL as well: PFpar = polyfit(time, tide, 3) AdjustedTide = polyval(PFpar,time)

대략 12년 전 | 0

답변 있음
code for pseudo random index generator
You provide little information, but this might help: AllKeys = [10 13 22 -9 0 12345] N = 3 ; % randomly select N of ...

대략 12년 전 | 0

| 수락됨

답변 있음
i want to replace cell data to index.
To *replace* values at a location in a cell of A: Step 1: Create a function like this function X = MyReplace(X,ii,V) ...

대략 12년 전 | 0

답변 있음
double indexing
If the indices are stored in variables, this is trivial! V = [1,2,5,7,9] ii = 1:4 jj = [2 3] out = V(ii(jj))

대략 12년 전 | 3

답변 있음
How can I change pairs?
% the data A = {[1 2], [3 4] , [5 6]} % the insight help fliplr help cellfun % the engine B = cellfu...

대략 12년 전 | 0

| 수락됨

답변 있음
i am still waiting for the answer
42

대략 12년 전 | 0

답변 있음
i want to replace cell data to index.
To *insert* values at a location in a cell of A: A = {[1 2 3 4 ] [5 6] [ 7 8 9]} ; index = [2 1 3] ; B = [10 11 12] ;...

대략 12년 전 | 0

답변 있음
generating a subset of specific of unique 3 groups out of 84
The following generates three arrays with 3 columns and 1680 rows each. Each row corresponds to a unique combination of numbers....

대략 12년 전 | 0

답변 있음
Constuctiing special array (like binary)
Take a look at *COMBN*: <http://www.mathworks.com/matlabcentral/fileexchange/7147-combn-4-3> USe like this: N = 2 ; M...

대략 12년 전 | 0

답변 있음
Filling up zeros forward/backward columnwise
This looks like a job for *FILLZERO* : <http://www.mathworks.com/matlabcentral/fileexchange/19906-fillzero-v2-1-may-2008>

대략 12년 전 | 0

답변 있음
How to combine random size arrays in one matrix - in a loop?
You have several options how to store vectors with different lengths. 1) use cell arrays C = cell(k,1) ; for k=1:10, ...

대략 12년 전 | 2

답변 있음
how to filter files in matlab
Here is some code to get you started: CopyFolder = './MyFolder' ; fid = fopen('files2copy.txt'); Files = textscan(f...

대략 12년 전 | 0

답변 있음
How do I replace [ ] in an array with 0's
If I am not mistaken, the variable pathrisk is a cell array with some empty cells? pathrisk = {1 [] 5 3 [] [] 9} % examp...

대략 12년 전 | 28

답변 있음
How to compare two rows in a cell {n x 1}
To see if the elements of a cell are identical, use _isequal_ C = {1:4 ; 1:2, 1:4} isequal(C{1},C{2}) isequal(C{1},...

대략 12년 전 | 0

답변 있음
How to combine several arrays?
Apparently, Selec is a cell array. You can convert into a numerical array by concatenation: Selec = {[0] [0] [1] [0] [0] [0...

대략 12년 전 | 0

| 수락됨

답변 있음
Assignment of values in an empty matrix by logical indices
For a matrix M, and scalars R, C and V, the expression M(r,c) = V means that you want to set the value of the Rth row an...

대략 12년 전 | 0

답변 있음
finding common elements in a matrix
I have to make a few assumptions as your question and comments are not clear. Case A - assumptions: (1) exactly one common el...

대략 12년 전 | 0

| 수락됨

답변 있음
help with concatenation / eval
*Avoid eval!* You want to use cell or structs. For example: initials = 'AB' weight = '171 lb' for n = 1:3 nam...

대략 12년 전 | 1

| 수락됨

답변 있음
Looking for an example showing short-cirkuit (&&) superior to normal (&) operation
In my view, the short-circuit behaviour of && and || is not primarily about speed, but more about code readability and ease of c...

대략 12년 전 | 0

| 수락됨

답변 있음
Does 'zeros' overwrite existing memory or alocate new memory and replace adress?
To set all elements of an existing array A to zero, A(:)= 0 is recommended (and faster).

대략 12년 전 | 1

| 수락됨

더 보기