Re: syntax again!



> 1) sample([1:4,[1:4])=x([1:3],[1:3]);

This is a little odd, I think you miss-typed it. The RHS (right hand
side) says take the upper left 9 numbers (3x3) from matrix "x" and
put them in...

But the left side is incorrect, maybe it should read
"sample([1:4],[1:4])?" But that would be odd, because it'd be
difficult to put 9 items (3x3) into 16 spaces (4x4).

Also, the square brackets are superfluous so I expect the author
wasn't an expert at MATLAB.

> 2) sample([1:4],[1:4])=sample>100;

The RHS says fill a 1xn array with zeros and ones, where the ones
represent when sample(i)>100 and zeros where sample(i)<=100.

For example,

sample = [12 100 110 90 101];

sample>100 would yield "0 0 1 0 1"

Note also that an N dimensional matrix can be represented as a 1xM
array:

sample = [100 101; 99 110] looks like

100 101
99 110

but that same array, re arranged in 1D format, by typing "sample(:),"
looks like

100 101 99 110

So, "sample(:)>100" gives "0 1 0 1."

Check out my examples for your benefit at

<http://www.mathworks.com/matlabcentral/fileexchange/loadFileList.do?objectType=fileexchange&orderBy=date&srt3=0>
.



Relevant Pages

  • Re: newbie: force paste as text?
    ... in an array, so I don't have the luxury of copying a cell at a time. ... Excel drops leading zeros when that is done unless the cell ... | Dim rets As String ...
    (microsoft.public.excel.programming)
  • Re: Problems referencing dates with the MATCH formula
    ... In answer to your second question, you can use this array* formula: ... replace the second cell reference in my AVERAGE formula. ... In this case I would like to include the zeros. ...
    (microsoft.public.excel)
  • Re: Max/min functions similar to SUMIF
    ... I'm not sure how MAX would be affected by having zeros or blanks in ... some of the cells, so I presume you mean MIN. ... An array formula needs to be committed using Ctrl-Shift-Enter ... range, mode, average, stdev of the above array. ...
    (microsoft.public.excel.misc)
  • Re: undetermined matrix solver
    ... Let D be a logical array the same size as y ... If you initially set x to all zeros as above, you don't need to make special ... true column in D, the x column is optimized and the y-column correctly ... computed zeros are then placed in the entire y column. ...
    (comp.soft-sys.matlab)
  • Re: Using IComparer to Sort a String Array
    ... In the context of your XxxComparer class, ... letter) All I need is a "comparer" class to return a sorted array. ... the unsorted string array that I provided was ... public int Compare(string lhs, string rhs) ...
    (microsoft.public.dotnet.languages.csharp)