From: "Ulrik Nash" <>
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$>
Reply-To: "Ulrik Nash" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1315063229 24591 (3 Sep 2011 15:20:29 GMT)
NNTP-Posting-Date: Sat, 3 Sep 2011 15:20:29 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: 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?