MATLAB Answers

0

H is a 108x108 tall array, P is a 108x9 double array, when excute etu=H\P , this syntax is wrong, what is right ?

Asked by donghai peng on 14 Jun 2019
Latest activity Commented on by lalikesbrains ongeveer 24 uur ago
H is a 108x108 tall array, P is a 108x9 double array, when excute etu=H\P ,
matlab report alarm massege:
Incompatible non-scalar tall array arguments. Each of the tall arrays must be the same size in the first dimension, must be derived from a single tall array, and must not have been indexed differently in the first dimension (indexing operations include functions such as VERTCAT, SPLITAPPLY, SORT, CELL2MAT, SYNCHRONIZE, RETIME and so on)
Is this syntax (etu=H\P) not right ?
Whant syntax for left divide should I use?
Thanks

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by John D'Errico
on 14 Jun 2019
Edited by John D'Errico
on 14 Jun 2019

Why would you use tall on a problem that tiny? Anyway, you could just convert to double. In fact, that proves you do not seem to have what you have just said you claim you have.
H = tall(rand(108,108));
whos H
Name Size Bytes Class Attributes
H 108x108 45 tall
rhs = rand(108,9);
H\rhs
ans =
108×9 tall double matrix
2.4572 0.48194 0.88151 1.5778 -0.56592 -0.58263 -0.97854 -0.45786 0.96671
1.2718 0.99114 0.53209 0.97513 -2.0726 -2.3997 0.13417 -2.5592 -0.022257
-0.67916 1.6978 -0.75485 0.84247 -1.9111 -3.0358 0.70922 -1.8236 -1.0565
-2.2082 -0.62135 -1.0939 -1.5911 2.4601 2.0494 0.5099 1.4656 0.1469
0.92375 -0.082748 0.43531 -0.091367 -1.236 -0.46374 -0.43555 -1.1131 0.054922
-3.3095 0.12047 -1.6272 -2.2056 1.1716 -0.27017 1.5322 0.46177 -0.76906
-0.26766 -1.4013 -0.33984 -0.48624 1.303 1.8449 -0.074787 0.82824 0.38399
0.4867 0.056338 0.061991 0.73609 0.24908 0.49141 -0.44451 0.78057 0.36349
: : : : : : : : :
: : : : : : : : :
So backslash works just fine. Does it produce the same result as the use on a double array?
(H\rhs) == (double(H)\rhs)
ans =
108×9 tall logical array
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
: : : : : : : : :
: : : : : : : : :
all(all((H\rhs) == (double(H)\rhs)))
ans =
tall logical
1
Yes. But no error is generated. That suggests you have done something that we are not told.
When you get an error, verify your belief that you have actually done what you claim to have done.
However, even if you have somehow created something that somehow fails the requirements outlined in the error message, it still does not preclude the abaility to convert to a double array here. So perhaps you have created H in a way that is different than I have done, and so H was created in some complex way that used one or more of:
VERTCAT, SPLITAPPLY, SORT, CELL2MAT, SYNCHRONIZE, RETIME
then you could still just do the trivial and convert to double. H is TINY. There is no neeed to use a tall array here.

  1 Comment

donghai peng's "Answer" moved here:
Thank you very much for your support.
I am testing tall array , so H is tiny.
H is a tall array double, but H data type shows unevaluated.
if need use gather function to H or not? if yes, will not fit computer memory when H is large.
Like this, i should how to do?
Thanks.

Sign in to comment.


Answer by donghai peng on 17 Jun 2019

fixed, thanks.

  1 Comment

How did you fix this? I'm having a similar issue with the .* operation. The two tall arrays are the exact same size but I get an error that says that the first dimension must be the same. I don't want to gather to run the operation because that would defeat the purpose of using the tall array in the first place.

Sign in to comment.