Mathematical Process and Some measurement ın varargout
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Gözde Üstün
am 17 Mai 2020
Beantwortet: Walter Roberson
am 17 Mai 2020
I have n matrices of size d*d(first 2 index of the array) for 2 different measurement(third index of the array) with d outcomes(fourth index of the array) with varargout:
function [varargout] = trying(d)
varargout = repmat({zeros(d,d,2,d)}, 1, max(nargout,1));
U=FourierMatrix(d);
% for k=1:d
% %varargout(k,k,1,k)=1;
% varargout(:,:,2,k)=U*varargout(:,:,1,k)*U';
% end
end
However I cannot use these process on varargout I mean for each element(comes from user (vararggout) I have 2 possibilities ) like:
for k=1:d
varargout(k,k,1,k)=1;
varargout(:,:,2,k)=U*varargout(:,:,1,k)*U';
end
And moreover the second measurement of the next element is the transpose of the previous one (In this step we can use the next element is the tranpose of the first element) like that:
B(:,:,2,k)=transpose(A(:,:,2,k));
But I could not know how can I apply this process on varargout??
(If I want to write this code for 2 element, it is easy and it will be like that:)
function [item1,item2]=trying(d)
U=FourierMatrix(d);
item1=zeros(d,d,2,d);
item2=item1;
for k=1:d
item1(k,k,1,k)=1;
item1(:,:,2,k)=U*item1(:,:,1,k)*U';
item2(k,k,1,k)=1;
item2(:,:,2,k)=transpose(item1(:,:,2,k));
end
Akzeptierte Antwort
Walter Roberson
am 17 Mai 2020
varargout(k,k,1,k)=1;
varargout is always a cell vector. It will not have 4 dimensions, and you cannot directly store numeric values into it.
You can index into it such as varargout{1}(k,k,1,k) = 1;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!