How to perform inverse between a page of a 3D matrix and a column vector without loops?

1 Ansicht (letzte 30 Tage)
The matrix H looks like 9 x 2 x 14 and matrix A1 is 9 x1. I need to perform inversion between every page of H with A using mldivide so that output looks like 2 x 1 x14 matrix. No loops.
clear all;
close all;
load H.mat
load A1.mat

Akzeptierte Antwort

Steven Lord
Steven Lord am 11 Jan. 2023
Why do you insist to do this without looping? If you have been told "for loops in MATLAB are slow" that is not necessarily the truth anymore.
But in this particular case it is possible to use pagemldivide to accomplish this task.

Weitere Antworten (1)

Kevin Holly
Kevin Holly am 11 Jan. 2023
Bearbeitet: Kevin Holly am 11 Jan. 2023
load H.mat
load A1.mat
ans = 1×3
9 2 14
ans = 1×2
9 1
answer = H.\A1;
ans = 1×3
9 2 14
  3 Kommentare
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota am 11 Jan. 2023
Hi Kelly,
The output is correct, but I dont want to use a loop. Is there any possibility without looping?

Melden Sie sich an, um zu kommentieren.


Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by