Row vector and corresponding column vector for each row

I want to create a single row vector with each element of the row array being a column vector and I want to access a certain element of any row number and the column which would be user-defined.

4 件のコメント

KL
KL 2017 年 12 月 5 日
... a single row vector with each element of the row array being a column vector...
What do you mean? A matrix? A row-vector like cell-array with column vectors?
...I want to access a certain element of any row number and the column...
Don't you want to create a row vector? row vector is supposed to have only one row!
Stephen23
Stephen23 2017 年 12 月 5 日
"...I want to access a certain element of any row number and the column which would be user-defined"
It sounds like a matrix would satisfy those requirements.
kd p
kd p 2017 年 12 月 5 日
The thing is that I need the output for the corresponding path of elements. That's why maybe this might help. Besides, the elements to be entered need not necessarily be integers, it can be a string or even .img files. What I basically need is to show output of a specified element.
Suppose there is a file named A which has several rows ..each row has many elements linked. Now let us find the path of the 5th element. The output should be such that - A\b\c\d\e.img (the target file being a .img format one)
kd p
kd p 2017 年 12 月 5 日
@KL i want a row vector with each element of row vector being a column vector which can store string values

サインインしてコメントする。

回答 (1 件)

Jos (10584)
Jos (10584) 2017 年 12 月 5 日

0 投票

Something like this?
% two cell arrays (being column vectors) of strings
c1 = {'hello', 'friend'}
c2 = {'my' ; 'name' ; 'is' ; 'joe'}
% create cell row vector holding these cell array of strings
r = {c1 c2}

3 件のコメント

kd p
kd p 2017 年 12 月 5 日
Thanks. But i want it to be as user input. That would work i think. But how do i get path for element? Like suppose i want path for joe it should be r\c2\joe .
kd p
kd p 2017 年 12 月 5 日
And it appeared as two different arrays. Can't it be in a single one? Like hello would have certain things and so would friend! .. like a rectangular matrix sort of thing only, not a matrix.
Jos (10584)
Jos (10584) 2017 年 12 月 5 日
編集済み: Jos (10584) 2017 年 12 月 5 日
Sorry, you've lost me. I suggest you read the Getting Started section of the manual and learn about cell arrays and structs. These might be what you are looking for.

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2017 年 12 月 5 日

編集済み:

2017 年 12 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by