I want to store multiple entries in one location in matrix

23 次查看(过去 30 天)
I want to form this type of matrix. kindly tell me the way to form such matrix., also how can i edit a single entry of any location.
Like in this matrix, if i want to change the middle entry i.e. 1/5 of first row and second column with new value 5. How can i change it.
Please provide a solution.
(1,1,1) (1/6, 1/5, 1/4)
(4, 5, 6) (1, 1, 1)
Thankyou!
I have akso attached a png file of my matrix.

回答(1 个)

KSSV
KSSV 2022-5-10
编辑:KSSV 2022-5-10
You can save them into a cell array. Read about cell.
% Dummy data demo
A = cell(2,3) ;
for i = 1:2
for j = 1:3
A{i,j} = rand(1,3) ;
end
end
A
A = 2×3 cell array
{[0.4545 0.5859 0.6816]} {[0.4719 0.1491 0.4351]} {[0.6638 0.1821 0.8371]} {[0.0395 0.8344 0.9757]} {[0.2598 0.7795 0.2263]} {[0.8550 0.8271 0.8162]}
You can access the cell array using: A{1,1}, A{2,3} etc.
You can print the specific cell array element using:
A{1,1}(1)
ans = 0.4545
A{2,2}(3)
ans = 0.2263
You can chnge any value in the cell array using:
A{1,1} = [1 2 3] ; % changing entire cell array (1,1)
A{2,2}(3) = 0 ; % changing third element of cell array (2,2)

类别

Help CenterFile Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by