similar to: 'Structure' compatible between Matlab and R

Displaying 20 results from an estimated 50000 matches similar to: "'Structure' compatible between Matlab and R"

2024 Feb 27
2
[External] converting MATLAB -> R | element-wise operation
> t(t(NN)/lambda) [,1] [,2] [,3] [1,] 0.5 0.6666667 0.75 [2,] 2.0 1.6666667 1.50 > R matrices are column-based. MATLAB matrices are row-based. > On Feb 27, 2024, at 14:54, Evan Cooch <evan.cooch at gmail.com> wrote: > > So, trying to convert a very long, somewhat technical bit of lin alg > MATLAB code to R. Most of it working, but raninto a stumbling block
2006 Apr 19
1
comparing execition time: R vs matlab linear algebra...
Greetings: We are evaluating the performance of R matrix algebra es as we port a MATLAB R14 script into R. The MATLAB code basically evaluates the AX=B system on sparse matrices that result in output matrices of 100 to 1,000,000 rows/columns. Our R prototype script uses spase base matrices and the methods qr() and qr.coeff(). The following statements are called inside a doubly-nested loop: G
2024 Feb 28
2
converting MATLAB -> R | element-wise operation
On Tue, 27 Feb 2024 13:51:25 -0800 Jeff Newmiller via R-help <r-help at r-project.org> wrote: > The fundamental data type in Matlab is a matrix... they don't have > vectors, they have Nx1 matrices and 1xM matrices. Also known as column vectors and row vectors. :) > Vectors don't have any concept of "row" vs. "column". They do in (numerical) linear
2001 Sep 14
3
stuff I used to do in Matlab
Hi, I'm new to R, and trying to map stuff I knew how to do in Matlab to R. For instances, in matlab, sum(x) gave the column sums of matrix(/vector) x. In R it just gives the sum of all the elements, regardless of their form (vector or matrix). Is there a simple way to return a vector of column sums for a matrix? Also, in Matlab binary operators exist for concatenating a matrix onto the end or
2024 Feb 27
2
converting MATLAB -> R | element-wise operation
Why anything but sweep? The fundamental data type in Matlab is a matrix... they don't have vectors, they have Nx1 matrices and 1xM matrices. Vectors don't have any concept of "row" vs. "column". Straight division is always elementwise with recycling as needed, and matrices are really vectors in row-major order: 1 2 3 4 5 6 is really 1 4 2 5 3 6 and when you do
2006 May 29
2
Analog to matlab repmat function
Hello, I'm trying to switch from Matlab to R-project, and having some difficulties. I make a use of multidimensional matrices. For example, I need to extract mean from one of the dimensions: % we have matrix data of size: 130 x 11 x 350 x 2 data = data - repmat(mean(data,3),[130 1 1 1]); In R project I managed to do that in a very pervarsive way: # mean(data,3) in R base <-
2010 Mar 24
3
help in matlab - r code
Dear list members, I need to translate 3 lines of matlab code to R (a loop, to be specific), and I don't know what would be the results in matlab or how to do it in R-- I don't realise if they are doing to the col, vector or what. if the results are a vector or a value or a matrix :-( Anyone with matlab, can run it and give me the result? Any ideias what am I doing wrong? The code is
2004 Oct 07
8
Equivalents of Matlab's 'find' and 'end'
Sorry if these questions have been asked recently--I'm new to this list. I'm primarily a Matlab user who is attempting to learn R and I'm searching for possible equivalents of commands that I found very handy in Matlab. So that I don't seem ungrateful to those who may answer, I HAVE determined ways to carry out these processes in 'brute force' sorts of ways in R code,
2008 Mar 26
2
Moving data between R and Matlab back and forth?
Hi to the list, I am trying to find a way to painlessly move structured data back and forth between R and Matlab (also Octave). For this purpose I found the R.matlab package great help. I wish to use a Matlab -v6 MAT file as an intermediary format, because it is well read by both Matlab and Octave. It is also well read by 'readMat' function in R.matlab package, but that is where I run
2024 Feb 27
4
converting MATLAB -> R | element-wise operation
So, trying to convert a very long, somewhat technical bit of lin alg MATLAB code to R. Most of it working, but raninto a stumbling block that is probaably simple enough for someone to explain. Basically, trying to 'line up' MATLAB results from an element-wise division of a matrix by a vector with R output. Here is a simplified version of the MATLAB code I'm translating: NN = [1,
2012 May 06
2
Translation of matlab vectors code into r
Hi there I am new user of r, i would need some help to translate som code for vectors in matlab to r. I have managed to translate the first 7 rows, but not the rest. Could anyone give me any suggestions for this problem?? Matlab code: tempo=[]; temps=[]; tempn=[]; tempao=[]; tempas=[]; tempan=[]; for k=1:5 tempo = [tempo n_o(k,:)]; temps = [temps n_s(k,:)]; tempn = [tempn
2012 Feb 04
1
least squares solution to linear system
Dear all I am having a linear system of the form A*X=B and I want to find the X by using least squares. For example my A is of dimension [205,3] and my B is of dimension[205,1]  I am looking for the X matrix which is of the size [3,1]. In the matlab I was doing that by the function  X = LSCOV(A,B) returns the ordinary least squares solution to the     linear system of equations A*X = B, i.e., X
2006 Sep 27
3
multidimensional lists
In the process of moving a number of my scripts from MATLAB -> R, I've discovered that there is no 'pure' equivalent of MATLAB's cell arrays, which I use quite often. Basically, I create matrices (as a cell array) where each element of the matrix is itself a matrix (e.g., 2x2 cell array where each element of the array is another matrix). I pass these cell arrays to various
2009 Dec 24
3
Newbie: colSums() compared with Matlab's sum()
Hi all, I'm trying to learn R after years of Matlab's experience. Here is an issue I couldn't solve today. Consider the following piece of code (written by memory): for(i in 1:n){ submat <- data[1:i,] C <- colSums(submat) } The problem is that at the first iteration, data[1:1,] reduces to a vector and colSums returns an error. This sounds really strange to me
2004 Jan 20
1
evaluation of discriminant functions+multivariate homosce dasticity
While I don't know anything about Box's M test, I googled around and found a Matlab M-file that computes it. Below is my straight-forward translation of the code, without knowing Matlab or the formula (and done in a few minutes). I hope this demonstrates one of Prof. Ripley's point: If you really want to shoot yourself in the foot, you can probably program R to do that for you. [BTW:
2010 Aug 27
8
R.matlab package help
Hi,all I have a problem running R.matlab package (under 2.10.1 version). I can set up the matlab server under local machine(run the MatlabServer.m), " And I can use setVariable and evaluate matlab functions in R. But when I ask Matlab to send the value back to R using getVariable function it always returns an error: " ??? Error: A MATLAB string constant is not
2012 Jul 02
1
error to convert a Compute A^-1 B from Matlab to R using solve(A, B)
Dear Researchers, I need to convert the following equation in R from Matlab a = [x y ones(size(x))]; b = [-(x.^2+y.^2)]; a\b ans = -9.9981 -16.4966 -7.6646 my solution in R is: a = cbind(x,y,rep(1,length(x))) b = cbind(-(x^2+y^2)) > head(a) x y [1,] 14.45319 5.065726 1 [2,] 14.99478 5.173893 1 [3,] 14.64158 5.616916 1 [4,] 14.61803 6.624069 1 [5,] 14.19997
2010 Nov 17
3
Find in R and R books
Hello everyone. In matlab  (again) there is a fucntion find that returns you the indexes where the condition in find was met. I want the same functionality in R i.e find(Mydata>2) to return all the indexes where the condition is met. Do you know something like that? Also when I try to search in google using for example the word R inside the search lemma I get very few results as the R confuses
2006 Nov 09
2
Repeated Measures MANOVA in R
Can R do a repeated measures MANOVA and tell what dimensionality the statistical variance occupies? I have been using MATLAB and SPSS to do my statistics. MATLAB can do ANOVAs and MANOVAs. When it performs a MANOVA, it returns a parameter d that estimates the dimensionality in which the means lie. It also returns a vector of p-values, where each p_n tests the null hypothesis that the mean
2009 Dec 01
1
eigenvalues of complex matrices
Dear all, I want to compute the eigenvalues of a complex matrix for some statistics. Comparing it to its matlab/octave sibling, I don't get the same eigenvalues in R computing it from the exact same matrix. In R, I used eigen() and arpack() that give different eigenvalues. In matlab/octave I used eig() and eigs() that give out the same eigenvalues but different to the R ones. For real