Path: news.mathworks.com!not-for-mail
From: "Ulrik Nash" <uwn@sam.sdu.dk>
Newsgroups: comp.soft-sys.matlab
Subject: Using an expression on all values in a matrix
Date: Sat, 3 Sep 2011 15:20:29 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <j3tgjt$o0f$1@newscl01ah.mathworks.com>
Reply-To: "Ulrik Nash" <uwn@sam.sdu.dk>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1315063229 24591 172.30.248.37 (3 Sep 2011 15:20:29 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 3 Sep 2011 15:20:29 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: news.mathworks.com comp.soft-sys.matlab:742140

Hi Everyone,

Suppose I have a matrix A. Now I wish to create a matrix B, where each value in B is the corresponding value in A, but with this value in A being part of an expression.

Let me give an example:

Expression: 2^((cells in A) + 1)

A = [1 2;1 3]

B =[4 8;4 16]

Since B = 2^(A+1) doesn't work, what will?

Regards,

Ulrik.