Effacer les filtres
Effacer les filtres

How to make a loop for an array of ands including cell arrays

2 vues (au cours des 30 derniers jours)
Hossein
Hossein le 18 Août 2016
Commenté : Hossein le 19 Août 2016
Hi
I want to make a loop for the following expression:
location1=find ( ...
equation{1}<1e-1 & ...
equation{2}<1e-1 & ...
equation{3}<1e-1);
each "equation {}" is a cell array and each cell includes a three dimensional matrix. I do not know how to and all of these equations in a loop way.
Thanks
  2 commentaires
James Tursa
James Tursa le 18 Août 2016
Please provide more detail. Maybe a short example showing inputs and desired output.
Hossein
Hossein le 19 Août 2016
Thanks for your attention. "equation{i}" gives me a three dimensional matrix of real numbers. So, in the aforementioned command, we have 3 matrices which are three dimensional. I need to find the places (in these three dimensional matrices) at which for all these three 3-dimensional matrices the value is less than one.

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 18 Août 2016
%------Example--------------------
A=cell(1,5)
A=cellfun(@(x) rand(10,9,8),A,'un',0)
%--------------------------------------
idx=cellfun(@(x) find(x<0.01),A,'un',0) % Locations
  1 commentaire
Hossein
Hossein le 19 Août 2016
Thanks for your good response. The point is that I want to "and" all of these together. In addition, consider the number of cells should be defined during the code and before that I do not know how many cells I will have. So, I guess I need a for-loop which can "and" any number of matrices and find the locations at which the criteria I want is satisfied.
Regards

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by