二维逻辑数组去判断三维数组。

假设我有一个三维数组A 10x20x100,10x20是平面坐标,100是每个高度上该坐标点对应的值
现有一个逻辑数组 ,in(10x20), 把三维数组中~in的点设为nan
for k = 1:100
   aa = squeeze(A(:,:,k));
   aa(~in)=nan;
   B (:,:,k)  = aa;
end  
请问可以不用循环码?

 Respuesta aceptada

pynbkjt
pynbkjt el 21 de Mayo de 2023

0 votos

可以写成函数啊,对不同的变量调用不就好了吗?

Más respuestas (0)

Categorías

Más información sobre 运算符和基本运算 en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Mayo de 2023

Respondida:

el 21 de Mayo de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!